The first issue may be resolved using if else :
If Statements in C++ - Cprogramming.com[
^]
The second issue requires a loop:
C++ Loop Types[
^]
eg you could use an infinite loop with an exit condition and then break on a certain number:
break statement - cppreference.com[
^]
#include <iostream>
using namespace std;
int main () {
for( ; ; ) {
if(operation == 1)
.....;
else if(operation==...)
......;
else if(operation==99)
break;
else
cout << "Operator error: Please enter a number between 1 and 4." << endl;
}
return 0;
}
Note the use of the std namespace:
Name visibility - C++ Tutorials[
^]