#include <iostream>
using namespace std;
class numbers
{
public:
int x,y;
void getdata()
{
cout<<"Enter the two numbers to add:";
cin>>x>>y;
}
};
class add:public numbers
{
public:
int z;
void calc()
{
z=x+y;
cout<<"\nThe Addition of two numbers is:"<<z;
}
};
class sub:public add
{
int w;
public:
void subtract()
{
cout<<"\nEnter a number to subtact:";
cin>>w;
}
void process()
{
cout<<"\nThe Subtraction is "<<z-w;
}
};
int main()
{
sub s;
s.getdata();
s.calc();
s.subtract();
s.process();
}
To embed this project on your website, copy the following code and paste it into your website's HTML: