s as indicated by the comments. na directory of your choice, and then make th le Calculator.cpp.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 11E
icon
Related questions
Question

// Calculator.cpp - This program performs arithmetic, ( +. -, *. / ) on two numbers.// Input: Interactive// Output: Result of arithmetic operation#include <iostream>#include <string>using namespace std;// Write performOperation() function declaration hereint main() { double numberOne, numberTwo; string operation; double result; cout << "Enter the first number: "; cin >> numberOne; cout << "Enter the second number: "; cin >> numberTwo; cout << "Enter an operator (+.-.*,/): "; cin >> operation; // Call performOperation method here cout << numberOne; cout << " " << operation << " "; cout << numberTwo; cout << " = "; cout << result << endl; return 0;} // End of main() function// Write performOperation function here

ert
CHAPTER 9
Advanced Modularization Techniques
1. Open the source code file named Calculator.cpp using Notepad or the text editor of
your choice.
2. Write the C++ statements as indicated by the comments.
3. Save this source code file in a directory of your choice, and then make that directory
your working directory.
4. Compile the source code file Calculator.cpp.
5.
Execute the program.
Transcribed Image Text:ert CHAPTER 9 Advanced Modularization Techniques 1. Open the source code file named Calculator.cpp using Notepad or the text editor of your choice. 2. Write the C++ statements as indicated by the comments. 3. Save this source code file in a directory of your choice, and then make that directory your working directory. 4. Compile the source code file Calculator.cpp. 5. Execute the program.
L ab 9-4: Writing Functions that Return a Value
In this lab, you complete a partially written C++ program that includes a function that
returns a value. The program is a simple calculator that prompts the user for two numbers
and an operator (+, -, *, or / ). The two numbers and the operator are passed to the function
where the appropriate arithmetic operation is performed. The result is then returned to the
main) function where the arithmetic operation and result are displayed. For example, if the
user enters 3, 4, and *, the following is displayed:
3 * 4 = 12
%3D
The source code file provided for this lab includes the necessary variable declarations and
input and output statements. Comments are included in the file to help you write the
remainder of the program.
Transcribed Image Text:L ab 9-4: Writing Functions that Return a Value In this lab, you complete a partially written C++ program that includes a function that returns a value. The program is a simple calculator that prompts the user for two numbers and an operator (+, -, *, or / ). The two numbers and the operator are passed to the function where the appropriate arithmetic operation is performed. The result is then returned to the main) function where the arithmetic operation and result are displayed. For example, if the user enters 3, 4, and *, the following is displayed: 3 * 4 = 12 %3D The source code file provided for this lab includes the necessary variable declarations and input and output statements. Comments are included in the file to help you write the remainder of the program.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Declaring and Defining the Function
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
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