编译错误请教
  • 板块灌水区
  • 楼主cyz11
  • 当前回复5
  • 已保存回复6
  • 发布时间2023/11/25 15:52
  • 上次更新2023/11/25 17:09:24
查看原帖
编译错误请教
1037934
cyz11楼主2023/11/25 15:52

请问一下,这个程序为什么会编译错误啊?先不要管是哪道题了

#include<bits/stdc++.h>
using namespace std;
char a[10001];
int b[10001],top=0,x;
int main()
{
	memset(b,0,sizeof(b));
	cin>>a;
	for(int i=0;i<=strlen(a)-2;i++)
		if(a[i]!=' '){
			if(a[i]=='+'){
				b[top--]+=b[top+1]; continue;}
			if(a[i]=='-'){
				b[top--]-=b[top+1]; continue;}
			if(a[i]=='*'){
				b[top--]*=b[top+1]; continue;}
			if(a[i]=='/'){
				b[top--]/=b[top+1]; continue;}
			x=0;
			while(a[i]!=' ') x=x*10+a[i++]-'0'; 
			top++;
			b[top]=x;}
			cout<<b[top]<<endl;
	return 0;
}
2023/11/25 15:52
加载中...