Question
Using C++ Create a FUNCTION that contains a switch statement that simulates a simple calculator. Repeatedly call this function with a Do While loop, prompting
Using C++
Create a FUNCTION that contains a switch statement that simulates a simple calculator.
Repeatedly call this function with a Do While loop, prompting for a new operator and integer, until the calculator returns 0, in which case the program will close.
I created the entire program without a function, but it became clear that my professor was seeking a function. I took a cop out, and essentially just made the entire program a function and called it once in another .cpp file, but, as i expected, that wasn't acceptable either.
I need help reformatting this so the calculator function is within the Do while loop, and then we're passing in the original data, and it continually updates the variables until it returns 0 and closes.
int calculatorO char op; double inl, in2; cout "Enter an operator, either +, -, *, / : "
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started