Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simple Calculator: I am having an error stating: expected unqualified-id before '{' token File: Calculator.cpp Line: 43 // Write performOperation function here double performOperation(double numberOne,double

Simple Calculator:

I am having an error stating:

expected unqualified-id before '{' token

File: Calculator.cpp
Line: 43

// Write performOperation function here double performOperation(double numberOne,double numberTwo,string operation);

this is lines 41 and 42. Any suggestions as to what is wrong?

// 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 double performOperation(double,double,string);

int 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 result =performOperation(numberOne,numberTwo,operation);

cout << numberOne; cout << " " << operation << " "; cout << numberTwo; cout << " = "; cout << result << endl; system("pause"); return 0;

} // End of main() function // Write performOperation function here double performOperation(double numberOne,double numberTwo,string operation); { double result = 0; if(operation == '+')

result = numberOne + numberTwo; else if(operation == '-') result = numberOne - numberTwo; else if(operation == '*'); result = numberOne * numberTwo;

else if(operation == '/'); result = numberOne / numberTwo;

return result; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago