Instructions • Input: Prompt the user to enter an arithmetic expression involving two whole numbers and one of the operators , +, -, in the format x operator (e.g., 3 * 2). Use cin >> x >> op >> y; for input. Processing: Use a switch statement to perform the appropriate arithmetic operation based on the entered operator (*, +, -, 7). • Output: Display the result of the arithmetic operation to the user. What to do: 1. Prompt the user to enter an arithmetic expression as x operator y. Use cin >> x >> op >> y; to capture these inputs. 2. Employ a switch statement to determine the appropriate arithmetic operation to perform based on the entered operator. 3. Display the calculated result to the user. Criteria: • Use cin >> x >> op >> y; to capture user input. • Your code must utilize a switch statement for decision-making. • Only the operators *, +, -, / should be accepted. • You must use appropriate variable types and maintain a clear code structure. Code should be well-documented. C: C:\Windows\system32\cmd.exe Enter an expression 3 2 The produce is 6 Press any key to continue . . .

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
Instructions
• Input: Prompt the user to enter an arithmetic expression involving two whole numbers and one of the operators , +, -, in the format x operator
(e.g., 3 * 2). Use cin >> x >> op >> y; for input.
Processing: Use a switch statement to perform the appropriate arithmetic operation based on the entered operator (*, +, -, 7).
• Output: Display the result of the arithmetic operation to the user.
What to do:
1. Prompt the user to enter an arithmetic expression as x operator y. Use cin >> x >> op >> y; to capture these inputs.
2. Employ a switch statement to determine the appropriate arithmetic operation to perform based on the entered operator.
3. Display the calculated result to the user.
Criteria:
• Use cin >> x >> op >> y; to capture user input.
• Your code must utilize a switch statement for decision-making.
• Only the operators *, +, -, / should be accepted.
• You must use appropriate variable types and maintain a clear code structure.
Code should be well-documented.
C: C:\Windows\system32\cmd.exe
Enter an expression
3 2
The produce is 6
Press any key to continue . . .
Transcribed Image Text:Instructions • Input: Prompt the user to enter an arithmetic expression involving two whole numbers and one of the operators , +, -, in the format x operator (e.g., 3 * 2). Use cin >> x >> op >> y; for input. Processing: Use a switch statement to perform the appropriate arithmetic operation based on the entered operator (*, +, -, 7). • Output: Display the result of the arithmetic operation to the user. What to do: 1. Prompt the user to enter an arithmetic expression as x operator y. Use cin >> x >> op >> y; to capture these inputs. 2. Employ a switch statement to determine the appropriate arithmetic operation to perform based on the entered operator. 3. Display the calculated result to the user. Criteria: • Use cin >> x >> op >> y; to capture user input. • Your code must utilize a switch statement for decision-making. • Only the operators *, +, -, / should be accepted. • You must use appropriate variable types and maintain a clear code structure. Code should be well-documented. C: C:\Windows\system32\cmd.exe Enter an expression 3 2 The produce is 6 Press any key to continue . . .
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT