Question: Write a C++ program using switch-case that accepts two integers using a single cin and an arithmetic operator (+. - *, , or %)

Write a C++ program using switch-case that accepts two integers using a 

Write a C++ program using switch-case that accepts two integers using a single cin and an arithmetic operator (+. - *, , or %) using another cin. Based on the operator input, the program will perform the arithmetic operation and display the result with a nicely formatted message. If the user enters any character other than the operators mentioned, it should display Invalid operator. One of the use case example for the program is: Enter the numbers: 85 20 Enter the arithmetic operator: + The sum of 85 and 20 is 105.

Step by Step Solution

3.43 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include int main 11 int num1 num2 char op Input numbers stdcout Enter the ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!