#include<iostream.h>
#include<conio.h>
class add
{
public:
int c;
void put(int,int);
void show(void);
};
void add::put(int a,int b)
{
c=a+b;
}
void add::show()
{
cout<<"\n Addition= "<<c;
}
class sub:public add
{
public:
void put1(int,int);
void show1(void);
};
void sub::put1(int a,int b)
{
c=a-b;
}
void sub::show1()
{
cout<<"\n Subtraction= "<<c;
}
class mul:public sub
{
public:
void put2(int,int);
void show2(void);
};
void mul::put2(int a,int b)
{
c=a*b;
}
void mul::show2()
{
cout<<"\n Multiplication= "<<c;
}
class div:public mul
{
public:
void put3(int,int);
void show3(void);
};
void div::put3(int a,int b)
{
c=a/b;
}
void div::show3()
{
cout<<"\n Division= "<<c;
}
void main()
{
clrscr();
cout<<endl<<endl;
div d;
d.put(10,5);
d.show();
d.put1(10,5);
d.show1();
d.put2(10,5);
d.show2();
d.put3(10,5);
d.show3();
getch();
}
#include<conio.h>
class add
{
public:
int c;
void put(int,int);
void show(void);
};
void add::put(int a,int b)
{
c=a+b;
}
void add::show()
{
cout<<"\n Addition= "<<c;
}
class sub:public add
{
public:
void put1(int,int);
void show1(void);
};
void sub::put1(int a,int b)
{
c=a-b;
}
void sub::show1()
{
cout<<"\n Subtraction= "<<c;
}
class mul:public sub
{
public:
void put2(int,int);
void show2(void);
};
void mul::put2(int a,int b)
{
c=a*b;
}
void mul::show2()
{
cout<<"\n Multiplication= "<<c;
}
class div:public mul
{
public:
void put3(int,int);
void show3(void);
};
void div::put3(int a,int b)
{
c=a/b;
}
void div::show3()
{
cout<<"\n Division= "<<c;
}
void main()
{
clrscr();
cout<<endl<<endl;
div d;
d.put(10,5);
d.show();
d.put1(10,5);
d.show1();
d.put2(10,5);
d.show2();
d.put3(10,5);
d.show3();
getch();
}
No comments:
Post a Comment