Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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.

image text in transcribed

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions