Functions Calculator

HI, so I'm making a calculator using functions, but its not working properly. So im asking if anyone can look and show me the right direction ? and if you want, make and show a correction version of my code ...

Here's What I Have SO Far:

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>

double AddNum(int num1, int num2);
double SubNum(int num1, int num2);
double MultNum(int num1, int num2);
double DiviNum(int num1, int num2);


using namespace std;

int main()
{
int num1, num2, option;

string MENU = "Menu \n1 = Add\n2 = Subtract\n3 = Multiply\n4 = Divide\n5 = Raise to the Power\n6 = Even or Odd\n7 Quit";// this will output a list of usable programs to use
cout << MENU << "\n Please select your option (#1-7)" << endl;
cin >> option;
switch (option)
{
case 1:
{
AddNum(num1, num2);
cout << "Please enter an integer:";
cin >> num1;

cout << "Please enter another integer: ";
cin >> num2;

cout << "The sum of " << num1 << " and " << num2 << " is " << num1 + num2 << endl;
break;
}
case 2:
{ SubNum(num1, num2);
cout << "Please enter an integer: ";
cin >> num1;

cout << "Please enter another integer: ";
cin >> num2;

cout << "The difference of " << num1 << " and " << num2 << " is " << num1 - num2 << endl;
break;
}
case 3:
{
MultNum(num1, num2);
cout << "Please enter an integer: ";
cin >> num1;

cout << "Please enter another integer: ";
cin >> num2;

cout << "The product of " << num1 << " and " << num2 << " is " << num1 * num2 << endl;
break;
}
case 4:
{
DiviNum(num1, num2);
cout << "Please enter an integer: ";
cin >> num1;

cout << "Please enter another integer: ";
cin >> num2;
cout << "The quotient of " << num1 << " and " << num2 << " is " << num1 / num2 << endl;
break;
}


case 5:
{
cout << "Please enter an integer: ";
cin >> num1;

cout << "Please enter another integer: ";
cin >> num2;

double x = num1;
cout << pow(x, num2);
cout << "The Number of" << x << " raised to the power of" << num2 << "is" << pow(x, num2) << endl;
break;
}

case 6:
{
cout << "Please enter an integer: ";
cin >> num1;

if (num1 % 2 == 0)
cout << "The Number Is EVEN.";

else
cout << "The Number Is ODD";
break;
}

case 7:
{
cout << "You are now Leaving the Calculator, GOODBYE !!! " << endl;
break;
}

default:
cout << "Invalid Entry!\nPlease re-run the program and " << endl;
cout << "enter a valid menu choice.\n";
break;
}


system("pause");
return 0;
}

Last edited on
Use Code Tags:


[code]
//Your Code Here
[/code]



You don't have any function definitions for the prototypes you made above:

1
2
3
4
double AddNum(int num1, int num2);
double SubNum(int num1, int num2);
double MultNum(int num1, int num2);
double DiviNum(int num1, int num2);
Topic archived. No new replies allowed.