Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!