#include
#include
using namespace std;
int main()
{
const char* pass = "abc123";
char str[100];
int i;
for(i=0; i<3; i++){
cout << "请输入密码:";
if(strcmp(gets(str),pass)==0)
break;
}
if(i>=3){
cout << "三次密码错误,退出" << endl;
return 0;
}
double a, b;
char ch;
cout << "请输入两个数:";
cin >> a >> b;
do{
cout << "请选择运算符:\n\t1===>加\n\t2===>减\n\t3===>乘\n\t4===>除\n";
cin >> ch;
}while(ch<'1'||ch>'4');
switch(ch){
case '1': cout << a+b << endl; break;
case '2': cout << a-b << endl; break;
case '3': cout << a*b << endl; break;
case '4': if(b!=0) cout << a/b << endl; else cout << "不能除以0" << endl;break;
}
return 0;
}