Question
include #include #include #include using namespace std; class all { private: struct address { int house; char street[30]; char city[30]; char state[30]; char country[30]; };
include #include #include #include using namespace std; class all { private: struct address { int house; char street[30]; char city[30]; char state[30]; char country[30]; }; struct age { int day; int month; int year; }; struct patient_info { char name[50]; address AD1; //nested structure implemented age A1; //nested structure inplemented int martial_status; int reg_no; int bld_group; int sex; }PI[100]; int task; protected: void enter_patient_info(); void show_patient_detail(); public: void software_detail(); void tasks(); void insert_data_into_file(int); char answer; char answer1; char ch; int serial; }; class date { private: int date; int month; int year; public: void enter_date(); string show_date(); }; class dob { private: struct dob1 { int date; int month; int year; int rem; }DOB11[100]; public: void enter_date(); string show_date(); }; int i=0; int rem; int count; int regis; int attempt; int temp; int show_count=0; all A1; //object declared date D1; //object declared dob DOB1; //object declared int main() { count=0; cout<<" \t\t\t Welcome To"<<" "; cout<<" \t\t\t***HOSPITAL MANAGEMENT SOFTWARE***"<<" "; D1.enter_date(); A1.tasks(); return 0; } cout<<" \t\t\t *****************************"<<" "; cout<<"Please select a task to do...."<<" "; cout<<"1. Enter a new patient information ."<<" "; cout<<"2. View detail of existing patient ."<<" "; cout<<"3. View detail about the program ."<<" "; cout<<"4. Exit from the program ."<<" "; //other function remain cout<<"Enter your task serail :"<<" "; cin>>task; switch(task) { case 1:{ A1.enter_patient_info(); break; } case 2:{ A1.show_patient_detail(); break; } case 3:{ A1.software_detail(); break; } case 4:{ cout<<"Thank You for trying this program !!!"<<" "; cout<<" This is the end of program...."<<" "; cout<<" Press any key to exit....."<<" "; exit(0); break; } default:{ cout<<"Invalid task serial ."<<" "; cout<<"Press any key to continue...."<<" "; A1.tasks(); } } } void all::enter_patient_info() { answer='y'; if(count==0) { serial=1; } else { i=serial; } for(i=serial;answer=='y'||answer=='Y';i++) { PI[i].reg_no=i; temp=serial; cout<<" ***ENTERING INFORMATION FOR PATIENT SERIAL NUMBER "<>PI[i].sex; while(PI[i].sex!=1&&PI[i].sex!=2) { cout<<"Invalid input for sex of patient!!!"<<" "; cout<<"Sex :"<<" "; cout<<" "; cin>>PI[i].sex; } cout<<"***ENTERING ADDRESS**"<<" "; cout<<"House number :"<<" "; cout<<" "; cin>>PI[i].AD1.house; while(PI[i].AD1.house<=0) { cout<<"Invalid input for house number ."<<" "; cout<<"Again enter the house number ."<<" "; cout<<" "; cin>>PI[i].AD1.house; } cin.get(ch); cout<<"Street :"<<" "; cout<<" "; cin.getline(PI[i].AD1.street,30); cout<<"City :"<<" "; cout<<" "; cin.getline(PI[i].AD1.city,30); cout<<"State :"<<" "; cout<<" "; cin.getline(PI[i].AD1.state,30); cout<<"Country :"<<" "; cout<<" "; cin.getline(PI[i].AD1.country,30); DOB1.enter_date(); //to calculate age cin.get(ch); cout<<"Martial status(1-Married,2-Not Married ):"<<" "; if(count!=0) { cout<<" "; } cin>>PI[i].martial_status; while(PI[i].martial_status<1||PI[i].martial_status>2) { cout<<"Invalid input for martial status ."<<" "; cout<<"Enter a valid martial status :"<<" "; cout<<" "; cin>>PI[i].martial_status; } cin.get(ch); if(count!=0) { cout<<" "; } NOTE : (can someone please let me know which dsa concepts are used in this code and what are the things teacher asked during viva regarding this program.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started