0
已解决
徐烨奎
新手光能
新手光能
#include<bits/stdc++.h>
using namespace std;
int main()
{
system("color F5");
cout<<"小小计算器\n";
cout<<"温馨提示:如果三次输入错误,则计算结束\n" ;
char c;
double a,b;
cout<<"请输入一个符号\n";
cin>>c;
cout<<"请输入两个数\n";
cin>>a>>b;
system("cls");
if(c!='+'&&c!='-'&&c!='*'&&c!='/'){
cout<<"输入错误\n请从新输入\n";
char c;
double a,b;
cin>>c;
cin>>a>>b;
system("cls");
if(c!='+'&&c!='-'&&c!='*'&&c!='/'){
cout<<"输入错误\n请从新输入\n";
char c;
double a,b;
cin>>c;
cin>>a>>b;
system("cls");
if(c=='+'){
cout<<a+b;
}
else if(c=='-'){
cout<<a-b;
}
else if(c=='*'){
cout<<a*b;
}
else if(c=='/'){
cout<<a/b;
}
}
else if(c!='+'&&c!='-'&&c!='*'&&c!='/'){
return 0;
}
else if(c=='+'){
cout<<a+b;
}
else if(c=='-'){
cout<<a-b;
}
else if(c=='*'){
cout<<a*b;
}
else if(c=='/'){
cout<<a/b;
}
system("color 5F");
if(c=='+'){
cout<<a+b;
}
else if(c=='-'){
cout<<a-b;
}
else if(c=='*'){
cout<<a*b;
}
else if(c=='/'){
cout<<a/b;
}
}
else if(c=='+'){
cout<<a+b;
}
else if(c=='-'){
cout<<a-b;
}
else if(c=='*'){
cout<<a*b;
}
else if(c=='/'){
cout<<a/b;
}
system("color 5F");
return 0;
}