-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hospital.cpp
75 lines (75 loc) · 1.72 KB
/
Hospital.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
struct date
{
int year,month,date;
};
class patient
{
protected:
char name[20];
date adm;
char disease[20];
date dis;
public:
void getdata();
void show();
};
class newpatient:public patient
{
int age;
public:
void getage();
void showinfo();
};
void patient::getdata()
{
cout<<"\nEnter patient name:";
gets(name);
cout<<"\nEnter the date of admission of patient:";
cin>>adm.date;
cout<<"\nEnter the month of admission of patient:";
cin>>adm.month;
cout<<"\nEnter the year of admission of patient:";
cin>>adm.year;
cout<<"\nEnter the disease of patient:";
gets(disease);
cout<<"\nEnter the date of discharge of patient:";
cin>>dis.date;
cout<<"\nEnter the month of discharge of patient:";
cin>>dis.month;
cout<<"\nEnter the year of discharge of patient:";
cin>>dis.year;
}
void patient::show()
{
cout<<"\nPatient Name:"<<name;
cout<<"\nPatient Admission Date:"<<adm.date<<"-"<<adm.month<<"-"<<adm.year;
cout<<"\nPatient Disease:"<<disease;
cout<<"\nPatient Discharge Date:"<<dis.date<<"-"<<dis.month<<"-"<<dis.year;
}
void newpatient::getage()
{
cout<<"\nEnter patient age:";
cin>>age;
}
void newpatient::showinfo()
{
if(age<12)
{
cout<<"\nPatient Age:"<<age;
show();
}
else
cout<<"\nOnly for patients less than 12 in age";
}
void main()
{
clrscr();
newpatient n1;
n1.getdata();
n1.getage();
n1.showinfo();
getch();
}