I can't see the two chapters .. Record at will.
# Include <iostream> # include <string> Using STD: cout; Using STD: Endl; double calculation (double A, double B, char OP) {Switch (OP) {Case '+': Return A + B; Case '-': return a-B; Case '*': return a * B; Case '/': return a/B ;}} double num = 0; double num2 = 0; char op = 'a'; int main () {// int num = 2; // cout <Test (); // STD: CIN >:: num; // cout <num; // STD: String wenzi = "hhaha "; // cout <wenzi; cout <"unscientific calculator \ n enter two numbers \ n enter the first number \ n"; STD: CIN >:: num; cout <"enter the second number \ n"; STD: CIN >>:: num2; cout <"Enter the operator +,-, *,/\ n "; STD: CIN> op; cout <"your result is: \ n"; cout <calculation (Num, num2, OP); Return 0; // exit this program}
In fact, the most important thing is to learn an interesting thing in the group:
Include <string> the string type cannot be used directly in C ++. Later, we figured it out that string is the reference type ..