
MST
Program 18
C++ Konrad Dzwonkiewicz
Using Switch with char
values
This
is a sample program that will act as a calculator.
Have
the program ask for the operation by entering the appropriate symbol. This will
process through the switch where you check all possible symbols that could be
entered
(+,
-, *, x, X, \, /, ^, and anything else you can think of that I’ve missed).
If
they enter a bad one input gracefully with a parting message.
(this could be your default in the switch…)
case ‘+’: add(first, second);
break;
default: cout<<”Bad Input…Now quitting”<<endl;
for((long int)x=0;
x<8000000; ++x); //pause
}
Ask the numbers to be operated on (two
numbers)
Produce the output in one of the five
functions (multiply, add, divide, subtract or power)


![]()

