#include<iostre am.h>
#include<conio. h>
class doctor
{
char name[20],dp[20],speci[20];
public:
void read();
void print();
};
class patient
{
char name[20],disease[20];
int age;
public:
void read();
void print();
};
class ip:public doctor,public patient
{
int admino,bedno;
public:
void read();
void print();
};
void doctor::read()
{
cout<<"Name of dr:\n";
cin>>name;
cout<<"Departme nt:\n";
cin>>dp;
cout<<"Speciali st:\n";
cin>>speci;
}
void doctor::print()
{
cout<<"Dr name:\t"<<name;
cout<<"\ndepart ment name:\t"<<dp;
cout<<"\nspecia list in:\t"<<speci;
}
void patient::read()
{
cout<<"Patient name:\n";
cin>>name;
cout<<"age:\n";
cin>>age;
cout<<"Disease: \n";
cin>>disease;
}
void patient::print( )
{
cout<<"\nPatien t Name:\t"<<name;
cout<<"\nage:\t "<<age;
cout<<"\ndiseas e:\t"<<disease;
void ip::read()
{
cout<<" IP PATIENT\n";
cout<<" \/\/\/\/\/\n";
doctor::read();
patient::read() ;
cout<<"\nEnter the admission date:";
cin>>admino;
cout<<"\nEnter the bed no:";
cin>>bedno;
}
void ip::print()
{
cout<<"\n|||||| ||||||||||||||| |\n";
cout<<"\nDetail s of IP Patient\n";
doctor::print() ;
patient::print( );
cout<<"\nadmin no:\n"<<admino;
cout<<"\nbed no:\n"<<bedno;
}
void main()
{
clrscr();
ip obj1;
obj1.read();
obj1.print();
getch();
};
#include<conio. h>
class doctor
{
char name[20],dp[20],speci[20];
public:
void read();
void print();
};
class patient
{
char name[20],disease[20];
int age;
public:
void read();
void print();
};
class ip:public doctor,public patient
{
int admino,bedno;
public:
void read();
void print();
};
void doctor::read()
{
cout<<"Name of dr:\n";
cin>>name;
cout<<"Departme nt:\n";
cin>>dp;
cout<<"Speciali st:\n";
cin>>speci;
}
void doctor::print()
{
cout<<"Dr name:\t"<<name;
cout<<"\ndepart ment name:\t"<<dp;
cout<<"\nspecia list in:\t"<<speci;
}
void patient::read()
{
cout<<"Patient name:\n";
cin>>name;
cout<<"age:\n";
cin>>age;
cout<<"Disease: \n";
cin>>disease;
}
void patient::print( )
{
cout<<"\nPatien t Name:\t"<<name;
cout<<"\nage:\t "<<age;
cout<<"\ndiseas e:\t"<<disease;
void ip::read()
{
cout<<" IP PATIENT\n";
cout<<" \/\/\/\/\/\n";
doctor::read();
patient::read() ;
cout<<"\nEnter the admission date:";
cin>>admino;
cout<<"\nEnter the bed no:";
cin>>bedno;
}
void ip::print()
{
cout<<"\n|||||| ||||||||||||||| |\n";
cout<<"\nDetail s of IP Patient\n";
doctor::print() ;
patient::print( );
cout<<"\nadmin no:\n"<<admino;
cout<<"\nbed no:\n"<<bedno;
}
void main()
{
clrscr();
ip obj1;
obj1.read();
obj1.print();
getch();
};
Comment