PROGRAM C Operation: Operation by CodeChum Admin You have been cordially invited to partake in Operation: Operation. Your mission, should you choose to accept it, is to take the two numbers and the operator given then perform the operation successfully. Instructions: Input one number (integer or decimal), an operator (+, -, *, /), and another number (integer or decimal). Again, since we're scanning a character, don't forget to add a space before the character's placeholder like this, " %c", so that it won't be the newline character that will be scanned for the operator. Print the result of the operation between the two numbers, up to 2 decimal places. Input 1. First number 2. Operator 3. Second number Output The first line will contain a message prompt to input the first number. The second line will contain a message prompt to input the operator. The third line will contain a message prompt to input the second number. The last line contains the result with 2 decimal places. Enter·the·first·number:·5 Select·the·operator·(+,·-,·*,·/):·+ Enter·the·second·number:·0.70 Result·=·5.70

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question
100%

PROGRAM C

Operation: Operation

by CodeChum Admin

You have been cordially invited to partake in Operation: Operation. Your mission, should you choose to accept it, is to take the two numbers and the operator given then perform the operation successfully.

 

Instructions:

  1. Input one number (integer or decimal), an operator (+, -, *, /), and another number (integer or decimal). Again, since we're scanning a character, don't forget to add a space before the character's placeholder like this, " %c", so that it won't be the newline character that will be scanned for the operator.
  2. Print the result of the operation between the two numbers, up to 2 decimal places.

Input

1. First number

2. Operator

3. Second number

Output

The first line will contain a message prompt to input the first number. The second line will contain a message prompt to input the operator. The third line will contain a message prompt to input the second number. The last line contains the result with 2 decimal places.

 

Enter·the·first·number:·5
Select·the·operator·(+,·-,·*,·/):·+
Enter·the·second·number:·0.70
Result·=·5.70

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,