#include<iostream.h> #include<conio.h> #include<process.

h> 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(); char answer; char answer1; char ch; int serial; }; class date { private: int date; int month; int year; public: void enter_date(); void show_date(); }; class dob {

show_date(). cout<<" ". int month. int rem. void show_date(). cout<<" ". D1. all A1. //object declared dob DOB1.private: struct dob1 { int date. cout<<" ". int attempt. int temp. //object declared date D1. int show_count=0. public: void enter_date().tasks(). }DOB11[100]. int regis. cout<<" ***HOSPITAL MANAGEMENT SOFTWARE***"<<" ".enter_date(). A1. //object declared void main() { count=0. cout<<"Welcome to."<<" ". }. cout<<" ***HOSPITAL MANAGEMENT SOFTWARE***"<<" ". D1.. int i=0.. int rem. cout<<" ". int year. } void all::tasks() { attempt=0. int count. cout<<" By Mustafizur Rohman **Hospital Management Tasks**"<<" *****************************"<<" "<<" By Mustafizur Rohman "<<" .

View detail of existing patient .. Enter a new patient information .. Exit from the program . } case 2:{ A1. cout<<" 1.. cout<<"3..software_detail().."<<" This is the end of program. cout<<" Press any key to exit. cout<<"4. switch(task) { case 1:{ A1."<<" ".. View detail about the program .enter_patient_info(). //other function remain cout<<" Enter your task serail :"<<" ". cin>>task."<<" . } default:{ clrscr().."<<" ".. } case 4:{ clrscr(). exit(0)."<<" "."<<" ". getch(). break. } case 3:{ A1. cout<<" ". cout<<"2. break..show_patient_detail()."<<" ".Please select a task to do. cout<<" Thank You for trying this program !!!"<<" ". break.."<<" ". break. cout<<" Invalid task serial .

"<<" "..reg_no<<" ". cin. A1. } for(i=serial.reg_no=i. clreol(). cout<<" Registration Number : "<<PI[i]. if(count==0) { serial=1.i++) { PI[i].".answer=='y'||answer=='Y'.sex!=2) { cout<<"Invalid input for sex of patient!!!"<<" ". } } } void all::enter_patient_info() { clrscr().sex. cout<<" ***ENTERING INFORMATION FOR PATIENT SERIAL NUMBER "<<i<<"***"<<" ".50). .sex. cout<<"Press any key to continue.name. while(PI[i].sex!=1&&PI[i]. cout<<"Sex :"<<" ". clrscr().getline(PI[i]. cout<<"Enter the name of patient :"<<" ". cin. cin>>PI[i]. temp=serial. } else { i=serial.. } cout<<" ***ENTERING ADDRESS**"<<" ".get(ch). clreol(). answer='y'. getch(). cout<<"Sex (1-Male 2-Female) :"<<" ". cin>>PI[i]..tasks(). clreol().

house<=0) { cout<<"Invalid input for house number .30). cout<<"Enter a valid martial status :"<<" ". cout<<"Country :"<<" ". clreol(). cin>>PI[i]. cin>>PI[i].AD1.get(ch).30). clreol().city. cin.getline(PI[i].getline(PI[i].martial_status. cin. clreol().AD1.cout<<"House number :"<<" ". if(count!=0) { clreol().AD1. clreol(). clreol()."<<" ". cout<<"Street :"<<" ".martial_status>2) { cout<<"Invalid input for martial status . cin>>PI[i]. cout<<"City :"<<" ".AD1. cin."<<" ".AD1.martial_status<1||PI[i]. if(count!=0) { clreol(). //to calculate age cin. cout<<"Blood group :"<<" . } cin.house. cout<<"Again enter the house number .AD1. } cin.get(ch).country.martial_status. clreol().AD1. cin. while(PI[i].house.state. DOB1.30).get(ch)."<<" ". cout<<"State :"<<" ". cout<<"Martial status(1-Married.getline(PI[i].2-Not Married ):"<<" ".30).enter_date(). } cin>>PI[i]. clreol(). } clreol().street. while(PI[i].getline(PI[i].

clreol().". cout<<"3.bld_group. clreol(). B. O.bld_group!=8) { clreol().bld_group!=5&&PI[i]. clreol()."<<" ".bld_group!=4&&PI[i]. cin>>PI[i]."<<" ". A+ "<<" ". cin>>PI[i].bld_group) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:{ break.bld_group. cout<<"Enter :"<<" ". cout<<"4. cout<<"5. clreol(). clreol().bld_group!=3&& PI[i].bld_group!=7&&PI[i]. AB+ "<<" ". .bld_group!=6&& PI[i]. AB. O+ "<<" ". clreol(). cout<<"2. cout<<"Invalid input !"<<" ". A. clreol().bld_group!=2&&PI[i]. } default:{ while(PI[i]. cout<<"1. clreol(). cout<<"6. clreol(). switch(PI[i]."<<" ". cout<<"Blood Group :"<<" ". cout<<"7. clreol(). clreol().bld_group!=1&&PI[i]. cout<<"8. B+ "<<" "."<<" ".

cout<<"Again enter the month :"<<" ". cin>>DOB11[temp]. cout<<" Want to enter information for another patient ? "<<" ".year. cout<<"Invalid input for year !"<<" ". cin>>answer.year<=0||DOB11[temp]. if(DOB11[temp]. clreol(). count++.month<=0||DOB11[temp]. A1. clreol().tasks(). clreol(). } clreol(). cout<<"Month :". cin>>DOB11[temp]. clreol().month>12) { do { clreol(). cout<<" Year :". } } cin. } clrscr(). cout<<"Invalid input for month !"<<" ". clreol(). }while(DOB11[temp]. cout<<"Please enter the year correctly :"<<" ".year. . cout<<" Date of birth"<<" ".month. clreol(). serial++. cin>>DOB11[temp]. if(DOB11[temp].get(ch).year>10000) { do { clreol().} break.year>10000). } void dob::enter_date() { clreol().year<0||DOB11[temp].

cout<<"Invalid date !"<<" ". while(DOB11[temp]. cin>>DOB11[temp].date<0||DOB11[temp].date.month<0||DOB11[temp].date<0||DOB11[temp].if(count!=0) { clreol().month>12). } case 2:{ cin>>DOB11[temp]. cout<<"Invalid date !"<<" ". } } else { while(DOB11[temp]. } break.date.date>31) { clreol(). cin>>DOB11[temp].date>28) //for non-leap year { clreol().year%4==0) { while(DOB11[temp].date<1||DOB11[temp]. clreol(). if(DOB11[temp].date. cout<<"Invalid date !"<<" ".date. cout<<"Again enter the date :"<<" . cout<<"Again enter the date :"<<" ". } cin>>DOB11[temp].date>29) //for leap year { clreol(). clreol(). clreol().month. } cout<<"Date :". switch(DOB11[temp]. }while(DOB11[temp].month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12:{ cin>>DOB11[temp]. cout<<"Again enter the date :"<<" ".

} void date::enter_date() { cout<<" First of all I need the current date . cout<<" Year :". cout<<"Please enter the year correctly :"<<" ". } break. }while(year<0||year>10000). cin>>year. cin>>year.date>30) { clreol().. } } break.".date. cin>>DOB11[temp]. clreol(). } cout<<"Month :". } default:{ cin>>DOB11[temp]. if(month<=0||month>12) { do { cout<<"Invalid input for month !"<<" ". } } //end of switch clreol(). cout<<"Invalid date !"<<" ". cout<<"Again enter the month :"<<" ". cin>>DOB11[temp]. cout<<"Again enter the date :"<<" "..date. . clreol().date. if(year<=0||year>10000) { do { cout<<"Invalid input for year !"<<" ". cin>>month.date<1||DOB11[temp]. cin>>month."<<" ". while(DOB11[temp].

cout<<"Again enter the date :"<<" ". while(date<1||date>31) { cout<<"Invalid date !"<<" ". if(year%4==0) { while(date<0||date>29) //for leap year { cout<<"Invalid date !"<<" ". switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12:{ cin>>date. cin>>date. while(date<1||date>30) { cout<<"Invalid date !"<<" ". } default:{ cin>>date. cin>>date. } } break. cin>>date.}while(month<0||month>12). } case 2:{ cin>>date. cout<<"Again enter the date :"<<" . cout<<"Again enter the date :"<<" ". } break. } } else { while(date<0||date>28) //for non-leap year { cout<<"Invalid date !"<<" ". cout<<"Again enter the date :"<<" ". } cout<<"Date :".

goto over. break. break. switch(date) { case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20:{ cout<<"th ". } //end of switch } } void date::show_date() //remove the goto ststements in this function { clrscr(). cout<<date. cin>>date. } case 2:{ cout<<"nd ". cout<<"Hello.. } default:{ cout<<"th ". . rem=date%10... break. } case 3:{ cout<<"rd ".". } } over: switch(month) { case 1:{ cout<<"January . ". } break. } } switch(rem) { case 1:{ cout<<"st ". It's ". break. break.

} case 7:{ cout<<"July . break. break. ". ". break. break. break. ". } case 9:{ cout<<"September . ". } case 10:{ cout<<"October . ". break. break. } case 6:{ cout<<"June . } case 4:{ cout<<"April . ". } case 12:{ cout<<"December . break. break. } case 8:{ cout<<"August . } case 5:{ cout<<"May . ". ". . } void all::show_patient_detail() { do { clrscr(). } case 11:{ cout<<"November . } case 3:{ cout<<"March . break.} case 2:{ cout<<"February . break. } } cout<<year<<" ". ". ". ".

cin.sex==2) { cout<<"Female "<<" ". switch(PI[regis]. clreol(). clreol(). cout<<"Name ". cout<<"A". cout<<"A+ ". break. } case 4:{ : "<<PI[regis]. clreol(). cout<<"Sex : ". if(regis>0&®is<serial) { clreol(). break. cout<<" ***INFORMATION FOR PATIENT REGISTRATION NUMBER"<<regis<<"*** ".name<<" . clreol(). clreol(). } case 3:{ clreol(). show_count++. if(PI[regis]. break.bld_group) { case 1:{ clreol(). cout<<"B+ ". } case 2:{ clreol().get(ch).cout<<" Enter registration number :"<<" ". } cout<<"Blood Group : ". cin>>regis. clreol(). clreol(). } if(PI[regis].sex==1) { cout<<"Male "<<" ".

cout<<"O". break. clreol(). cout<<" House no. } case 7:{ clreol(). cout<<"B". cout<<"AB+ ". } case 6:{ clreol(). clreol(). break.AD1. clreol(). if(PI[i]. : "<<PI[regis]. } else { cout<<"Not married "<<" ". clreol(). } clreol().clreol(). break. cout<<"AB". } case 5:{ clreol(). cout<<" **ADDRESS**"<<" ". . DOB1. break. cout<<"Date of birth : ". } } clreol().show_date(). clreol(). cout<<"O+ ". } case 8:{ clreol(). clreol().house.martial_status==1) { cout<<"Married "<<" ". cout<<"Martial Status : ". break.

.. cout<<" Sorry. clrscr().. A1.AD1. getch().city.state."<<" ".."<<" ". cout<<"Press any key to continue. } clreol().country. cout<<"Press any key to exit to main task menu.AD1.tasks(). getch()."<<" ". } attempt++..AD1.AD1. } clreol(). A1."<<" ".. cout<<" State : "<<PI[regis]. "<<" ". the registration number is invalid . clreol(). getch(). clreol().street. clreol(). } else { if(regis==1) { cout<<" Database is empty !!!"<<" ". cout<<"Access Denied!!! "<<" ".tasks().show_patient_detail(). cout<<" City : "<<PI[regis].. clrscr(). cout<<"Please try again later. cout<<"Press any key to exit to main task menu. if(attempt==3) { cout<<" You have entered wrong registration number 3 times . A1. cout<<" Country : "<<PI[regis]."<<" ". clreol(). clreol(). cout<<" .cout<<" Street : "<<PI[regis].

} } over: switch(DOB11[regis]. }while(answer1=='y'||answer1=='Y'). ". clrscr(). goto over.date. cin>>answer1.date) { case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20:{ cout<<"th ". } case 2:{ cout<<"nd ". clreol(). break. . break.month) { case 1:{ cout<<"January .date%10. break. rem=DOB11[regis]. } } switch(rem) { case 1:{ cout<<"st ". break. A1. } default:{ cout<<"th ". break.Want to see information of another patient :"<<" ".tasks(). } void dob::show_date() { cout<<DOB11[regis]. clreol(). } case 3:{ cout<<"rd ". switch(DOB11[regis].

} case 5:{ cout<<"May . } void all::software_detail() { clrscr(). } case 3:{ cout<<"March . ". ". break. ". } } cout<<DOB11[regis]. ". } case 7:{ cout<<"July .year<<" ". ". break. break. break. break. ". cout<<" . break. ". ". ". break. } case 11:{ cout<<"November . break. } case 10:{ cout<<"October . ". } case 6:{ cout<<"June . } case 8:{ cout<<"August . ". break. } case 9:{ cout<<"September .} case 2:{ cout<<"February . break. } case 12:{ cout<<"December . } case 4:{ cout<<"April . break.

cout<<" Developer : Mustafizur Rohman "<<" ". } . cout<<" Aim : Simulation of the software used in Hospital"<<" ". A1. cout<<" Hope you like it.tasks().. getch(). cout<<" Programming Language : C++ "<<" ". "<<" "."<<" ".com ."<<" ".."<<" ".. cout<<" Send your comments to : mustafizur_04@sify..***SOFTWARE DETAILS*** ".... cout<<" Press any key to return to the main task menu.. cout<<" Thank You for trying this program.

Sign up to vote on this title
UsefulNot useful