Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

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.

Instructions

Write the C++ statements as indicated by the comments.

Execute the program by clicking the "Run Code" button at the bottom of the screen.

// Calculator.cpp - This program performs arithmetic, ( +. -, *. / ) on two numbers.

// Input: Interactive

// Output: Result of arithmetic operation

#include

#include

using namespace std;

// Write performOperation() function declaration here

int main()

{

double numberOne, numberTwo;

string operation;

double result;

cout

cin >> numberOne;

cout

cin >> numberTwo;

cout

cin >> operation;

// Call performOperation method here

cout

cout

cout

cout

cout

return 0;

} // End of main() function

// Write performOperation function here

i tried solving this but i am having one problem as shown in the picture

somebody can help me?

image text in transcribed

Test Results 4 / 5 passed Current Grade: 80.00% Code Pattern X FAILED: Declared performOperation() Test Case PASSED: Test for Addition ( PASSED: Test for Division PASSED: Test for Multiplication PASSED: Test for subtraction more

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions