添加项目文件。
This commit is contained in:
29
ScientificCalculator/main.cpp
Normal file
29
ScientificCalculator/main.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
#include<string>
|
||||
#include "Calc.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
string input;
|
||||
cout << "<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> q <20>˳<EFBFBD>)<29><>\n";
|
||||
|
||||
while (true) {
|
||||
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ > ";
|
||||
getline(cin, input);
|
||||
|
||||
if (input == "q" || input == "quit")
|
||||
break;
|
||||
|
||||
double result;
|
||||
if (Calc::safeEval(input, result)) {
|
||||
cout << "= " << result << endl;
|
||||
}
|
||||
else {
|
||||
cout << "[<5B><><EFBFBD><EFBFBD>] <20><><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>\n";
|
||||
}
|
||||
}
|
||||
|
||||
cout << "<EFBFBD><EFBFBD>лʹ<EFBFBD>ã<EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD><EFBFBD>" << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user