1.
//program to write the information of patients registered
2.
// and physician available in the hospital.The program asks
3.
//the user to register physician,register patient,
4.
//list all available physicians and lisit all registered patients
5.
// depending on the interest of the user.
6.
#include<iostream>
7.
#include<cstring>
8.
using namespace std;
9.
int main()
10.
{
11.
int i;
12.
char name[12],*nam=&name[0];
13.
int ch,n,phy_id[100],phy_workex[100];
14.
char phy_name[100],phy_spec[100];
15.
char *phyname=&phy_name[0];
16.
char pat_name[100],pat_gender[10],pat_case[50],ass_phy[12];
17.
char *patname=&pat_name[0];
18.
int m,pat_age[4],pat_cardno[20],pat_date[4];
19.
do
20.
{
21.
cout<<"\t\t\t TASK SELECTION WINDOW \n";
22.
cout<<"\t\t\t ********************* \n";
23.
cout<<"\t\tWhat would you like to do ?\n";
24.
cout<<"\t\t Please enter the number you choice \n";
25.
cout<<"\t\t 1.Register a physician/s \n";
26.
cout<<"\t\t 2.Register a patient/s \n";
27.
cout<<"\t\t 3.List all available physicians \n";
28.
cout<<"\t\t 4.List all registered patients \n";
29.
cout<<"\t\t 5.Quit a program \n";
30.
cout<<endl;
31.
cout<<"Please enter your choice !\n";
32.
cin>>ch;
33.
switch(ch)
34.
{
35.
case 1:
36.
cout<<"\t How many physician you want to register ?\n";
37.
cout<<"\t------------------------------------------\n";
38.
cin>>n;
39.
cout<<"Enter name,id,specification and work experiance of "<<n<<"physicians"<<endl;
40.
cout<<"--------------------------------------------------------------"<<endl;
41.
for( i=0;i<n;i++)
42.
{
43.
cout<<"\nEnter physician "<<i+1 <<" name :";
44.
cin>>phy_name;
45.
cout<<"Enter physician "<<i+1<<" id :";
46.
cin>>phy_id;
47.
cout<<"Enter physician "<<i+1 <<" specification :";
48.
cin>>phy_spec;
49.
cout<<"Enter physician "<<i+1 <<"work experiance :";
50.
cin>>phy_workex;
51.
cout<<endl;
52.
}
53.
break;
54.

55.
case 2:
56.
cout<<"\t How many patient you want to register ?\n";
57.
cout<<"\t -------------------------------------- \n";
58.
cin>>m;
59.
cout<<"Enter name,age,gender,card no,case,date and assigned physician of"<<m<<"patients"<<endl;
60.
cout<<"-------------------------------------------------------------------------"<<endl;
61.
for( i=0;i<m;i++)
62.
{
63.
cout<<"\n Enter patient "<<i+1<<" name :";
64.
cin>>pat_name;
65.
cout<<"\n Enter patient "<<i+1<<" age :";
66.
cin>>pat_age;
67.
cout<<"\nEnter patient "<<i+1<<" gender :";
68.
cin>>pat_gender;
69.
cout<<"\n enter patient "<<i+1<<" card number :";
70.
cin>>pat_cardno;
71.
cout<<"\n Enter patient"<<i+1<<" case :";
72.
cin>>pat_case;
73.
cout<<"\n Enter patient "<<i+1<<" date :";
74.
cin>>pat_date;
75.
cout<<"\n Enter patient "<<i+1<<" assigned physician :";
76.
cin>>ass_phy;
77.
cout<<endl;
78.
}
79.
break;
80.
case 3:
81.
cout<<"\t program to list all available physicians \n";
82.
cout<<"\t ---------------------------------------- \n";
83.
cout<<"Number "<<" name "<<"\t"<<"ID" <<"\t"<<"specification "<<"\t"<<"work exepriance \n";
84.
for(i=0;i<n;i++)
85.
{
86.

87.
cout<< i+1<<"\t"<<phy_name<<"\t"<<phy_id;
88.
cout<<"\t"<<phy_spec<<"\t\t"<<phy_workex;
89.
cout<<endl;
90.
}
91.
break;
92.
case 4:
93.
cout<<"\t\tprogram to list all registered patients \n";
94.
cout<<"\t\t****************************************\n";
95.
cout<<"number "<<"\t"<<"age"<<"\t"<<"gender"<<"\t"<<"card number ";
96.
cout<<"\t"<<"case"<<"\t"<<"date"<<"\t"<<"assigned physician";
97.
cout<<endl;
98.
for( i=0;i<m;i++)
99.
{
100.

101.
cout<< i+1<<"\t"<<pat_name<<"\t"<<pat_age<<"\t"<<pat_gender;
102.
cout<<"\t"<<pat_cardno<<"\t"<<pat_case<<"\t"<<pat_date;
103.
cout<<"\t"<<ass_phy<<endl;
104.
}
105.
break;
106.
case 5:
107.
cout<<"\tCongratulation you finished your program !\n";
108.
cout<<"\t-----------------------------------------\n";
109.
return 0;
110.
break;
111.
}
112.
}
113.
while(true);
114.
return 0;
115.
}

Salem commented: UGLY code fail! -4

Recommended Answers

All 2 Replies

1. Please remove your line numbers and use code tags.
2. We can't help you unless you tell us what you need help with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.