新手光能
#include<bits/stdc++.h>
using namespace std;
int main(){
system("color F5");
cout<<"小小计算器\n";
cout<<"版本2.11,作者:徐烨奎\n";
cout<<"数不能超过7位数!\n";
char c;
long double a,b;
cout<<"请输入一个符号(+加号,-减号,*乘号,/除号)\n";
cin>>c;
cout<<"请输入两个数\n";
cin>>a>>b;
if(a>=1000000||b>=1000000){
system("cls");
cout<<"数字超标";
return 0;
}
system("cls");
if(c=='+'||c=='-'||c=='*'||c=='/'){
cout<<"计算结束\n";
if(c=='+'){
cout<<a<<"+"<<b<<"="<<a+b;
}
if(c=='-'){
cout<<a<<"-"<<b<<"="<<a-b;
}
if(c=='*'){
cout<<a<<"*"<<b<<"="<<a*b;
}
if(c=='/'){
cout<<a<<"/"<<b<<"="<<a/b;
}
}
else if(c!='+'&&c!='-'&&c!='*'&&c!='/'){
system("cls");
cout<<"输入错误\n请重新输入\n";
char c;
double a,b;
cout<<"请输入一个符号(+加号,-减号,*乘号,/除号)\n";
cin>>c;
cout<<"请输入两个数\n";
cin>>a>>b;
if(c=='+'||c=='-'||c=='*'||c=='/'){
cout<<"计算结束\n";
if(c=='+'){
cout<<a<<"+"<<b<<"="<<a+b;
}
if(c=='-'){
cout<<a<<"-"<<b<<"="<<a-b;
}
if(c=='*'){
cout<<a<<"*"<<b<<"="<<a*b;
}
if(c=='/'){
cout<<a<<"/"<<b<<"="<<a/b;
}
}
}
system("cls");
if(c!='+'&&c!='-'&&c!='*'&&c!='/'){
system("cls");
cout<<"输入错误\n请重新输入\n";
char c;
double a,b;
cout<<"请输入一个符号(+加号,-减号,*乘号,/除号)\n";
cin>>c;
cout<<"请输入两个数\n";
cin>>a>>b;
system("cls");
if(c=='+'||c=='-'||c=='*'||c=='/'){
cout<<"计算结束\n";
}
if(c=='+'){
cout<<a<<"+"<<b<<"="<<a+b;
}
if(c=='-'){
cout<<a<<"-"<<b<<"="<<a-b;
}
if(c=='*'){
cout<<a<<"*"<<b<<"="<<a*b;
}
if(c=='/'){
cout<<a<<"/"<<b<<"="<<a/b;
}
else if(c!='+'&&c!='-'&&c!='*'&&c!='/'){
cout<<"输入错误";
return 0;
}
}
system("color 5F");
return 0;
}
中级天翼
#include<bits/stdc++.h>
using namespace std;
int main(){
system("color F5");
cout<<"小小计算器\n";
cout<<"版本2.11,作者:徐烨奎\n";
cout<<"数不能超过7位数!\n";
char c;
long double a,b;
cout<<"请输入一个符号(+加号,-减号,*乘号,/除号)\n";
cin>>c;
cout<<"请输入两个数\n";
cin>>a>>b;
if(a>=1000000||b>=1000000){
system("cls");
cout<<"数字超标";
return 0;
}
system("cls");
if(c=='+'||c=='-'||c=='*'||c=='/'){
//cout<<"计算结束\n";
if(c=='+')
cout<<a<<"+"<<b<<"="<<a+b;
if(c=='-')
cout<<a<<"-"<<b<<"="<<a-b;
if(c=='*')
cout<<a<<"*"<<b<<"="<<a*b;
if(c=='/')
cout<<a<<"/"<<b<<"="<<a/b;
}
else{
cout<<"输入错误\n请重新输入\n";
while(cin>>c>>a>>b){
if(c=='+'||c=='-'||c=='*'||c=='/'){
if(c=='+')
cout<<a<<"+"<<b<<"="<<a+b;
if(c=='-')
cout<<a<<"-"<<b<<"="<<a-b;
if(c=='*')
cout<<a<<"*"<<b<<"="<<a*b;
if(c=='/')
cout<<a<<"/"<<b<<"="<<a/b;
break;
}
}
}
return 0;
}
改了一下,好一点。
我都采纳你的了,就不能采纳一下我的吗???