//Sample Program to demonstrate the usage of Multiple Inheritance
#include < iostream.h >
#include < conio.h >
#include < stdio.h >
class personal
{
protected:
char name[20];
char add[45];
char gender;
public:
void get_info()
{
flushall();
cout << "\n Enter name: ";
gets(name);
cout << "\n Enter address: ";
gets(add);
cout << "\n Enter gender: ";
cin >> gender;
}
void put_info()
{
cout << "\n Entered name: " << name;
cout << "\n Entered address: " << add;
cout << "\n Entered gender: " << gender;
}
};
class physical
{
protected:
int ht,wt;
char bl[2];
public:
void get_detail()
{
cout << "\n Enter height: ";
cin >> ht;
 cout << "\n Enter weight: ";
cin >> wt;
cout << "\n Enter blood group: ";
cin >> bl;
}
void put_detail()
{
cout << "\n Entered height: "<> empno;
cout << "\n Enter salary: ";
cin >> sal;
cout << "\n Enter dept: ";
cin >> dept;

}
void disp_details()
{
cout << "\n Entered employee no: " << empno;
cout <<"\n Entered department: " << dept;
cout << "\n Entered salary: " << sal;
}
void increment()
{
long int incr=0;
if(gender=='m')
{
if(dept=='s'||dept=='p')
{
incr=(sal*10)/100;
sal=sal+incr;
cout << "\n Increment in salary: " << incr;
cout << "\n Incremented salary: " << sal;
}
}
else
incr=0;
if(gender=='f')
{
 if(dept=='s'||dept=='p')
{
incr=(sal*11)/100;
sal=sal+incr;
cout<<"\n Increment in salary: "<> ch;
ch=getchar();
}
while(ch=='y' || ch=='Y');
getch();
}
Click here to go back.

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus


Footer1