#include <string>
#include <stdlib.h>
using namespace std;
cout << " ********************************************************" << endl;
cout << " 命令行计算器" << endl << endl;
cout << " 1.用法介绍:第一次先输入一个数字,然后回车" << endl;
cout << " 2.输入运算符号,然后回车" << endl;
cout << " 3.再次输入一个数字,然后回车,程序会自动运算出结果" << endl;
cout << " 4.输入exit退出程序" << endl;
cout << " ********************************************************" << endl;
int leftParInt;
int rightParInt;
string rightParStr;
string calculator;
cout << "1.请输入运算左值:";
cin >> leftParStr;
return;
cin >> calculator;
return;
cin >> rightParStr;
return;
rightParInt = atoi(rightParStr.c_str());
cout << " The result of this calculator is: " << leftParInt + rightParInt << endl;
}
if(calculator == "-") {
cout << " The result of this calculator is: " << leftParInt - rightParInt << endl;
}
cout << " The result of this calculator is: " << leftParInt * rightParInt << endl;
}
cout << " The result of this calculator is: " << leftParInt / rightParInt << endl;
}
}