#include <iostream>
usingnamespace std;
class add
{
int a , b;
public:
void getNum(int , int);
int addition()
{
return a + b;
}
};
void add::getNum(int x, int y )
{
a = x;
b = y;
}
class Multiplication
{
int c , d;
public:
void getNum(int , int);
int multiply()
{
return c * d;
}
};
void Multiplication::getNum(int x, int y )
{
c = x;
d = y;
}
int main()
{
int x , y , z;
cout << "Please enter the first number : ";
cin >> x;
cout << "Please enter the second number : ";
cin >> y;
mylabel:
cout << "Enter 1 for addition , 2 for multiplication: " << endl;
cin >> z;
if ( z == 1 )
{
add Num;
Num.getNum(x,y);
cout << Num.addition();
}
if ( z == 2)
{
Multiplication Numbers;
Numbers.getNum(x,y);
cout << Numbers.multiply();
}
else {
cout << "Please enter one or two : ";
goto mylabel;
}
return 0 ;
}
Get rid of all the blank lines for a start.
Proper indentation - otherwise it looks like a bit of a dog's breakfast.
goto's are not good form either. try and get rid of them. :)