Hi guys,
could somebody please explain to me where this code is going wrong and why?
Code:#include <iostream> using namespace std; void mult (double x, double y); void add (double x, double y); void sub (double x, double y); void div (double x, double y); int main() { int selection = 0; double x = 0; double y = 0; //Main menu option do { cout << "Please select from one of the following options: " << endl << "1 - multiplication" << endl << "2 - addition" << endl << "3 - subtraction" << endl << "4 - division" << endl << "5 - exit" << endl << "Please enter make your selection: "; cin >> selection; cin.ignore(); if (selection != 5) { cout << "Please enter the first number: "; cin >> x; cin.ignore(); cout << "Please enter the second number: "; cin >> y; cin.ignore(); switch (selection) { case 1: void mult (double x, double y); break; case 2: void add (double x, double y); break; case 3: void sub (double x, double y); break; case 4: void div (double x, double y); break; case 5: break; default: cout << "Invalid selection!" << endl; break; } } }while (selection != 5); cout << "Thank you for using this calculator!" << endl; return 0; } void mult (double x, double y) { cout << "The product of your two numbers is " << x * y << endl; } void add (double x, double y) { cout << "The sum of your two numbers is " << x + y << endl; } void sub (double x, double y) { cout << "The subtract of your two numbers is " << x - y << endl; } void div (double x, double y) { cout << "The divisor of your two numbers is " << x / y << endl; }



LinkBack URL
About LinkBacks



GIK wins!!!