Wednesday, 1 May 2013

Company Employe Include in a list That Have Sialry and name and residanse in c++ and OOP'S


#include<conio.h>
#include<iostream.h>
class college
{
char name[10];
char res[10];
public:
void indata()
{
cout<<"Enter the name";
cin>>name;
cout<<"Enter the residence";
cin>>res;
}
void display()
{
cout<<"The name is"<<name<<endl;
cout<<"The residence is"<<res<<endl;
}
};
class office:public college
{
int age;
int salary;
char des[10];
public:
void indata1()
{
cout<<"Enter the age"<<endl;
cin>>age;
cout<<"Enter salary"<<endl;
cin>>salary;
cout<<"Enter designation"<<endl;
cin>>des;
 }
void display1()
 {
cout<<"The age="<<age<<endl;
cout<<"The salary="<<salary<<endl;
cout<<"The designation is:" <<des<<endl;
}
} ;
class collegues:public office
{
char looks[10];
char comp[10];
public:
void indata2()
{
indata();
indata1();
cout<<"Enter the looks"<<endl;
cin>>looks;
cout<<"Enter the complexion"<<endl;
cin>>comp;
cout<<endl;
}
void display2()
{
display();
display1();
cout<<"Looks:" <<looks<<endl;
cout<<"Complexion:"<<comp<<endl;
}
} ;
void main()
{
clrscr();
collegues c;
c.indata2();
c.display2();
getch();
}

No comments:

Post a Comment