Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that acts as a \'printing calculator\' using looping and dec

ID: 3647036 • Letter: W

Question

Write a C++ program that acts as a 'printing calculator' using looping and decision control structures. The program should allow the user to type in from the keyboard a float or an integer number and an operator (single character) one space apart in the expression as follows Number Operator (For example: 12 + Or 123/ Or 23 S) Only the following operators (as a single character) should be recognized by the program: + - / S E The S operator tells the program to set the 'Accumulator' to the typed in number. For example, S can be set to value 250.00. The E operator tells the program that execution for calculator is to end. The arithmetic operations are performed on the contents of the accumulator with the number that was keyed in acting as the second operand. In table below, the first column in the following table shows sample run showing how the program should operate by typing number and operator symbol, and the second column explains what the program is doing. Begin Calculations Printed as text message using cout 10 S = 10.0000 Sets the accumulator to 10. 2/ = 5.0000 Divide Accumulator value by 2 and display result 55 - = -50.0000 Subtract 55 from Accumulator value and display result 100.25 S Sets accumulator to 100.25 4* = 401.0000 Multiply Accumulator value by 4 and display result 0E = 401.0000 End of calculations End of Program by displaying "End of calculations" using cout.

Explanation / Answer

repost with >> to >op; while(op!='E'){ switch ( op )//check operator and do operator { case '+': sum=sum+input; break; case '-': sum=sum-input; break; case '*': sum=sum*input; break; case '/': sum=sum/input; break; case 'S': sum=input; break; } coutop; } cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote