Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need help in a C ++ code, it's about an assignment on Hospital System Management, I have this code and I need to

Hi, I need help in a C ++ code, it's about an assignment on Hospital System Management, I have this code and I need to implement data structres, it would be a great favor to help me as soon as possible, I have to implement queues, bags, linked list, stacks and if possible trees, you can modify the code and do it at your best, and create a class of the rooms of the hospital and add patients to it, it would be very pleasant thank you.

#include #include #include #include #include struct doctor1 { int id; char name[10],age[10],exp[10],city[10],special[10]; }; struct patient1 { int id1; char name[10],age[10],city[10],dis[10],room[10],charg[10],bill[10]; };

using namespace std; class doctor; class patient;

class hospital { public:

int counter=0; };

class doctor:public hospital { public: int docid=0; struct doctor1 arr[10];

void add_doc_info() { int i,en; cout<<"How Many Entries you want to add :"; cin>>en; for(i=1;i<=en;i++) { cout<<"Enter Doctor's ID :"; cin>>arr[docid].id; cout<<"Enter Doctor's Name :"; cin>>arr[docid].name; cout<<"Enter Doctor's Age :"; cin>>arr[docid].age; cout<<"Enter Doctor's Specialization :"; cin>>arr[docid].special; cout<<"Enter Doctor's Experience :"; cin>>arr[docid].exp; cout<<"Enter Doctor's city :"; cin>>arr[docid].city; docid++; counter++; cout<<" "; cout<<"You filled all Entries of "<>n; if(n==0) { cout<<" OOPS!!!! "<<" "; cout<<"Note:- No Record To Display Please Go Back And Enter Some Entries...... "<<" "; } else { int status=0; for(i=0;i

void doctor_detail() { int i; if(docid==0) { cout<<" OOPS!!!! "<<" "; cout<<"Note:- No Record To Display Please Go Back And Enter Some Entries...... "<<" "; } else{ cout<<"********************************************************************************"<<" "; cout<<"\t \t \t Details Of All The Doctors In The Hospital "; cout<<"********************************************************************************"<<" ";

cout<<"ID"<<"\t \t"<<"specialization"<<"\t \t"<<"Age"; cout<<" ";

for(i=0;i

class patient:public hospital { public: int docid1=0; struct patient1 arr[10]; void add_pat_info(); void Display(); void patient_report(); void patient_detail(); void tot_no_of_pat(); void gen_pat_report(); };

void patient :: add_pat_info() { int i,en; cout<<"How Many Entries you want to add :"; cin>>en; for(i=1;i<=en;i++) { cout<<" 1. Enter Patient's ID :"; cin>>arr[docid1].id1;

cout<<" 2. Enter patient's Name :"; cin>>arr[docid1].name; cout<<" 3. Enter patient's Age :"; cin>>arr[docid1].age; cout<<" 4. Enter patient's Disease :"; cin>>arr[docid1].dis; cout<<" 5. Enter Patient's Room No. :"; cin>>arr[docid1].room; cout<<" 6. Enter Patient's Room Charge :"; cin>>arr[docid1].charg; cout<<" 7. Enter Patient's Medicine charge :"; cin>>arr[docid1].bill; docid1++; counter++; cout<<" "; cout<<"You filled all Entries of "<

void patient :: Display() { system("cls"); int n,i; cout<<" Enter the Patient's ID to display info :"; cin>>n; if(n==0) { cout<<" OOPS!!!! "<<" "; cout<<"Note:- No Record To Display Please Go Back And Enter Some Entries...... "<<" "; cout<<" Press Any KEY To choose another Option.... "; } else { int status=0; for(i=0;i

void patient :: patient_report() { system("cls"); int i,n; cout<<" Enter the Patient's ID to Display Report :"; cin>>n; int status=0; for(i=0;i

getch(); }

void patient:: patient_detail() { int i; if(docid1==0) { cout<<" OOPS!!!! "<<" "; cout<<"Note:- No Record To Display Please Go Back And Enter Some Entries...... "<<" "; } else{ cout<<"********************************************************************************"<<" "; cout<<"\t \t \t Details Of All The Patient In The Hospital "; cout<<"********************************************************************************"<<" "; cout<<"ID"<<"\t \t"<<"illness"<<"\t \t"<<"\t \t"<<"Age"; cout<<" "; for(i=0;i

void patient :: tot_no_of_pat() { system("cls"); int i=counter; cout<<"Total Patients in Hospital : "<

void patient :: gen_pat_report() { system("cls"); int i,n; cout<<" Enter the Patient's ID to Display Bill :"; cin>>n; int status=0; for(i=0;i

else{ cout<<" No such ID in database "<

}

int main() { system("color F4");

bool repeat= true; int ch1,ch2,ch3,ch4; doctor d; patient p; menu: system("cls"); cout<<" "; cout<<" *** Welcome to the Hospital Management System *** "<<" "; cout<<" 1. Menu : "<<" ";; cout<<" 2. Exit : "<<" "; cout<<"Enter Your Choice :"; cin>>ch1; cout<<" ";

while (ch1<1||ch1>2){ system("cls"); cout<<"Error, choose available options"<>ch1; }

if(ch1==1) { menu2: system("cls"); cout<<" "; cout<<" 1. Enter into Doctor's DataBase "<>ch2; while(repeat==true) { system("cls"); switch(ch2) case 1: { cout<<" "; cout<<" *** Welcome To Doctor's DataBase *** "<<" ";

cout<< " \t 1. Add New Doctor's Information "<

cout<<"Please Enter your choice :"<<" "; cin>>ch3; switch(ch3) { case 1: system("cls"); d.add_doc_info();// las d viene de la clase de doctor que esta declarado en el main break; case 2: d.Display(); cout<<" "; break;

case 3: system("cls"); d.doctor_detail(); break;

case 4: d.tot_no_of_doc(); break;

case 5: goto menu2; break;

default: cout<<"invalid"; } break; case 2: cout<<" "; cout<<" *** Welcome To Patient's DataBase *** "<<" ";

cout<< "1. Add New Patient's Information "<

cout<<"Please Enter your choice :"<<" "; cin>>ch4; switch(ch4) { case 1: system("cls"); p.add_pat_info(); break; case 2: p.Display(); cout<<" "; break;

case 3: system("cls"); p.patient_detail(); break;

case 4: p.tot_no_of_pat(); break;

case 5: goto menu2; break;

default: cout<<"invalid"; break; } break; case 3:

p.patient_report(); goto menu2; break; case 4: p.gen_pat_report(); goto menu2; break; case 5: goto menu; break;

} } } else if(ch1==2) { return 0; } else { cout<<"Wrong Input"<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions