Hello,

I have written a program that allows the user to choose a calculator function, then enter numbers and then it gives the answer.

All is working, except for the square roots function.

Below is my program code, and then below that, there is my errors list.

I am stuck, so I was wondering if anyone cold help me out here.

Thank you:

Here is the Errors that I receive:Code:#include <iostream> #include <string> #include <cmath> using namespace std; int main () { string response ="n"; int function; double x; double y; int i; i = 0; do { cout << "Welcome" << endl; cout << "Choose one of the following functions:" << endl; cout << "1. Addition" << endl; cout << "2. Subtraction" << endl; cout << "3. Multiplication" << endl; cout << "4. Division" << endl; cout << "5. Powers" << endl; cout << "6. Square Roots" << endl; cout << "7. Sine" << endl; cout << "8. Cosine" << endl; cout << "9. Tangent" << endl; cout << "Enter number to choose function:" << endl; cin >> function; if (function == 1) { cout << "Addition Function." << endl; cout << "Enter two numbers to find their sum." << endl; cout << "Enter First Number:" << endl; cin >> x; cout << "Enter Second Number:" << endl; cin >> y; for (int i = 0; i < 1; i++) { cout << x << "+" << y << "=" << x + y << endl; } } if (function == 2) { cout << "Subtraction Function." << endl; cout << "Enter two numbers to find their difference." << endl; cout << "Enter First Number:" << endl; cin >> x; cout << "Enter Second Number:" << endl; cin >> y; for (int i = 0; i < 1; i++) { cout << x << "-" << y << "=" << x - y << endl; } } if (function == 3) { cout << "Multiplication Function." << endl; cout << "Enter two numbers to find their product." << endl; cout << "Enter First Number:" << endl; cin >> x; cout << "Enter Second Number:" << endl; cin >> y; for (int i = 0; i < 1; i++) { cout << x << "*" << y << "=" << x * y << endl; } } if (function == 4) { cout << "Division Function." << endl; cout << "Enter two numbers to find their Quotient." << endl; do { cout << "Enter First Number:" << endl; cin >> x; cout << "Enter Second Number:" << endl; cin >> y; if (x != 0 && y != 0) { for (int i = 0; i < 1; i++) { cout << x << "/" << y << "=" << x / y << endl; } } if (x == 0 || y == 0) { cout << " " << endl; cout << "Numbers can not be 0" << endl; cout << " " << endl; } } while (x == 0 || y == 0); } if (function == 5) { cout << "Powers Function." << endl; cout << "Enter First Number:" << endl; cin >> x; cout << "Enter Second Number:" << endl; cin >> y; for (int i = 0; i < 1; i++) { cout << x << "^" << y << "=" << std::pow(x,(float)y) << endl; } } if (function == 6) { cout << "Square Root Function." << endl; do { cout << "Enter Number:" << endl; cin >> x; if (x > 0) { for (int i = 0; i < 1; i++) { cout << "Square Root of " << x << " = " << std::sqrt(x) << endl; } } if (x < 0) { cout << " " << endl; cout << "Number can not be negative" << endl; cout << " " < endl; } } while (x < 0); } if (function == 7) { cout << "Sine Function." << endl; cout << "Enter Angle Measurement:" << endl; cin >> x; for (int i = 0; i < 1; i++) { cout << "Sine of " << x << " = " << std::sin(x) << endl; } } if (function == 8) { cout << "Cosine Function." << endl; cout << "Enter Angle Measurement:" << endl; cin >> x; for (int i = 0; i < 1; i++) { cout << "Cosine of " << x << " = " << std::cos(x) << endl; } } if (function == 9) { cout << "Tangent Function." << endl; cout << "Enter Angle Measurement:" << endl; cin >> x; for (int i = 0; i < 1; i++) { cout << "Tangent of " << x << " = " << std::tan(x) << endl; } } cout << " " << endl; cout << "Do you want to do this again? [enter y for yes]" << endl; cin >> response; } while (response == "Y" || response == "Yes" || response == "y" || response == "yes"); }

I am not sure what to do now, this is the only problem and then the program is done.Code:newCalc.cpp: In function `int main()': newCalc.cpp:140: no match for `ostream & < ostream & (&)(ostream &)' newCalc.cpp:140: candidates are: operator <(ostream & (*)(ostream &), ostream & (*)(ostream &)) <builtin> newCalc.cpp:140: operator <(void *, void *) <builtin>

If anyone thinks they could help me out, it would greatly appreciated!

Thanks!