CalculatorWithSwitch Program
Description
This program prompts the user to input two operands and a operator, then uses a switch structure to evaluate the operator to determine which operation to perform (+, -, *, or /), and calculates the result based on the operator.Associated Concepts:
Switch structure
Algorithm:
Input two operands and one operator from the keyboard
Use switch to evaluate the operator
For '+' operator, perform addition on two operands
For '-' operator, perform subtraction on two operands
For '*' operator, perform multiplication on two operands
For '/' operator, perform division on two operands
For any other operator, print an error message
Print the result
Use switch to evaluate the operator
For '+' operator, perform addition on two operands
For '-' operator, perform subtraction on two operands
For '*' operator, perform multiplication on two operands
For '/' operator, perform division on two operands
For any other operator, print an error message
Print the result