#include <iostream>
using namespace std;
class first
{
public:
int n1,n2;
void getdata()
{
cout<<"\n The value of No.1 : ";
cin>>n1;
cout<<"\n The value of No.2 : ";
cin>>n2;
}
};
class second:public first
{
public:
int tot;
void add()
{
tot=n1+n2;
}
};
class thrid:public second
{
int n3,z;
public:
void indata()
{
cout<<"\n The value of No.3 : ";
cin>>n3;
}
void sub()
{
z=tot-n3;
}
void display()
{
cout<<"\n The value of No.1 : "<<n1;
cout<<"\n The value of No.2 : "<<n2;
cout<<"\n The Total (No.1 + No.2) : "<<tot;
cout<<"\n The value of No.3 : "<<n3;
cout<<"\n The Subtraction (Total - No.3) : "<<z;
}
};
int main()
{
thrid t;
t.getdata();
t.add();
t.indata();
t.sub();
t.display();
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: