Math Solver Program (with functions)


The goal of this program is to allow the user to enter 3 numbers, and respectively carry out either Subtraction, Addition, Multiplication, or Division.


I'm fairly new. I think I've got the program down for the most part, but

inside my if statements like "Addnumbers(x,y,z);"

I get an error saying the identifiers are undefined.
How can I fix this??



#include <iostream>
#include <iomanip>

using namespace std;


int Addnumbers(int x, int y, int z)
{
int S;
S = x + y + z;

cout << "Please input 3 numbers" << endl;
cin >> x >> y >> z;

cout << "The three numbers added were " << x << " " << y <<" "<< z;

cout << "The solution to the addition problem is " << S;

return S;


}

int Subtraction(int x, int y, int z)
{
int S;
S = x - y - z;

cout << "Please input 3 numbers to subtract" << endl;
cin >> x >> y >> z;

cout << "The three numbers subtracted were " << x << y << z;

cout << "The solution to the subtraction problem is " << S;




return S;
}

int Division(int x, int y, int z)
{
int S;
S = x / y / z;

cout << "Please input 3 numbers to divide" << endl;
cin >> x >> y >> z;

cout << "The three numbers divided were " << x << y << z;

cout << "The solution to the division problem is " << S;

return S;



}
int Multiply(int x, int y, int z)
{
int S;
S = x * y * z;

cout << "Please input 3 numbers to divide" << endl;
cin >> x >> y >> z;

cout << "The three numbers multiplied were " << x << y << z;

cout << "The solution to the multiplication problem is " << S;

return S;
}
int main()
{


int submission;
cout << " Welcome to my math solver program! " << endl;

cout << " Please enter 1 for Addition, 2 for subtraction, 3 for Division, and 4 for multiplication " << endl;
cin >> submission;

if (submission == 1)
{

Addnumbers(x,y,z);




}
if (submission == 2)
{

Subtraction(x,y,z);




}
if (submission == 3)
{

Division(x, y, z);




}
if (submission == 4)
{

Multiply(x, y, z);




}



system("PAUSE");
return 0;
}
Do not double-post. Other thread: http://www.cplusplus.com/forum/general/243073/
Topic archived. No new replies allowed.