Switch/Case over if/else
I think it would be great if you use switch/case instead of if/else it also makes you code look neat. Something like this
case '+': result = num1 + num2; break;
case '-': result = num1 - num2; break;
case '*': result = num1 * num2; break;
case '/': result = num1 / num2; break;
cout << "Please enter valid operation" ;
Moreover, using switch/cases over if/else improves computational time when doing multiple iterations.
Add an OFF button
Also, the physical calculators that we use are always 'ON' unless they are turned off by pressing an 'OFF' button (or get turned off if no key is pressed for time \$t\$). You can also add that feature.
Instruction: type of input expected form user.
Say, a friend of yours wants to run the code, or you are an app developer and your client do not know anything about programming, and he just double-clicks on
calculator.exe file, it would be great if you can also mention a short note when the program begins telling what logical operations and input format is expected from the user.
Showing error message
When someone types in
num1 / 0. You can either show the error message
cout << DIVIDE_BY_ZERO_ERROR << endl;
Or simply say the answer in Infinity. And its value is
double a = std::numeric_limits<double>::infinity();
You do not need to show this value, just in case if you want to take this code further and add some more features like 'memory' like our typical calculators.
Note: this is not real infinity! It just a number such that \$a>b\,\,\forall b\$. There is more about Handling the Divide by Zero Exception in C++. Perhaps, I have given only a short glimpse sticking with minimal code policy.