Hi I'am having a problem in debugging this code of mine .There is a problem in the execution of cl.e file.
This is the code;
#include<iostream.h>
#include<string.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
class hospital {
char password;
int telno,mobno,fax;
char name[20],log,address[20], website[20],email[20];
public:
hospital;
int loging();
void menu();
class reception {//this class takes information of patients admitted
char p_name[20];
int age;
char gender;
int wardno;
int bedno;
int day,month,year;
public:
reception();
void patient_info();
void display_info();
~reception();
};//end of class reception
class clinic { //this is the function clinic for the outpatients
char p_name[20],examination[50],prescription[100];
int day, month, year;
public:
void get_info();
void display_info();
class dental {
char p_name[20],examination[50],prescription[100],treatment[100];
int day, month, year;
public:
void get_info();
void display_info();
};//end of class dental clinic
class eye_clinic {
char p_name[20],examination[50],prescription[100],treatment[100];
int day, month, year;
public:
void get_info();
void display_info();
};//end of class eye clinic
class dematological {
char p_name[20],examination[50],prescription[100],treatment[100];
int date, month, year;
public:
void get_info();
void display_info();
}; //end of class dematological clinic
};//end of class clinic
class pharmacy {
char p_name[20],doctor[20];
char d_name[20],prescriptions[50];
int price;
public:
void get_info();
void display_info();
};//end of class pharmacy
class laboratory {
char p_name[20];
char test[50];
char results[50];
int labfee;
int fee;
public:
void labbill();
void get_info();
void display_info();
};//end of class lab
class ward {
char p_name[20];
int age;
public:
void get_ward();
void display_ward();
class paediatric {
char p_name[20],examination[50],select;
int bedno,wardno,day,month,year,standingward_fee,no_days;
public:
void get_info();
int wardbill(int);
void display_info();
};//end of paediatric ward
class adult {
char sex,p_name[20],examination[50],select,ward[16];
int wardno,bedno,day,month,year,standingward_fee,no_days;
public:
void get_info();
int wardbill(int);
void display_info();
};//end of adult ward
class maternity {
char p_name[20],birth_status[20],doctor[20];
int day,month,year,no_hours;
char baby_sex[6];
public:
void get_info();
int wardfee();
void display_info();
};//end of class maternity
};//end of class ward
class icu {
char p_name[20],examination[50];
int day,month,year,time,no_days,medicalfee;
const int standingward_charge;
public:
void get_info();
int icu_fee();
void display_info();
};//end of the class icu
class finance_billing {
int amount,price,fee,t_bill;
public:
int bill(int);
void display_info();
};
//end of class finance_billing
hospital::hospital
{
cout<<"TUUNGANE HOSPITAL"<<endl;
cout<<"55502-00200 NAIROBI"<<endl;
cout<<"<A href="http://www.tuungane.org"<<endl">www.tuungane.org"<<endl;
cout<<"<A href="mailto:tuunagane@yahoo.com"<<endl">tuunagane@yahoo.com"<<endl;
cout<<"TELEPHONE NO. 861869"<<endl;
cout<<"MOBILEPHONE NO. 0721543764"<<endl;
}
int hospital::loging()
{
cout<<"Please enter the password";
cin>>password;
if (password==password){
cout<<"welcome to Tuungane Hospital System!";}
else{
cout<<"Wrong password!\n"<<"Sorry you are not an authorised user please enter N to exit";
switch(log)
{
case 'N':case 'n':return 0;;
}}
}
hospital::reception::reception()
{
p_name=="name";
wardno=001;
bedno=0001;
}
hospital::reception::~reception()
{
cout<<"Destructor called";
}
void hospital::reception::patient_info()
{
cout<<"Please enter the patients details"<<endl;
cout<<"Name :";
cin.getline(p_name,20)<<endl;
cout<<"Age :";
cin>>age;
cout<<endl;
cout<<"Ward number :";
cin>>wardno;
cout<<endl;
cout<<"Bed number :";
cin>>bedno;
cout<<endl;
cout<<"Enter the date of admission :";
cout<<"day/";
cin>>day;
cout<<"month/";
cin>>month;
cout<<"year";
cin>>year;
cout<<endl;
}
void hospital::reception::display_info()
{
cout<<"Patient's details :"<<endl;
cout<<"Name"<<p_name;
cout<<"Age"<<age;
cout<<"Ward"<<wardno;
cout<<"Bed"<<bedno;
cout<<day<<"/"<<month<<"/"<<year;
}
void hospital::clinic::get_info()
{
cout<<"patient's name";
cin.getline(p_name,20);
cout<<"examination"<<endl;
cin.getline(examination,50);
cout<<"Doctor's prescription :"<<endl;
cin.getline(prescription,50);
cout<<endl;
cout<<"Treatment given: "<<endl;
cin.getline(treatment,100);
cout<<"Date of treatment is :";
cout<<"day/";
cin>>day;
cout<<"month/";
cin>>month;
cout<<"year/";
cin>>year;
}
void hospital::clinic::display_info()
{
cout<<"Patient's name: "<<p_name<<endl;
cout<<"Examination:"<<examination<<endl;
cout<<"Prescription :"<<prescription<<endl;
cout<<"Treatment offered:"<<treatment<<endl;
cout<<"Date:"<<day<<"/"<<month<<"/"<<year<<endl;
void hospital::clinic::dental::get_info()
{
cout<<"patient's name";
cin.getline(p_name,20);
cout<<"examination"<<endl;
cin.getline(examination,50);
cout<<"Doctor's prescription :"<<endl;
cin.getline(prescription,50);
cout<<endl;
cout<<"Treatment given: "<<endl;
cin.getline(treatment,50);
cout<<"Date of treatment is :";
cout<<"day/";
cin>>day;
cout<<"month/";
cin>>month;
cout<<"year/";
cin>>year;
}
void hospital::clinic::dental::display_info()
{
cout<<"Patient's name: "<<p_name<<endl;
cout<<"Examination:"<<examination<<endl;
cout<<"Prescription :"prescription<<endl;
cout<<"Treatment offered:"<<treatment<<endl;
cout<<"Date:"<<day<<"/"<<month<<"/"<<year<<endl;
}
void hospital::clinic::eye_clinic::get_info()
{
cout<<"patient's name";
cin.getline(p_name,20);
cout<<"examination"<<endl;
cin.getline(examination,50);
cout<<"Doctor's prescription :"<<endl;
cin.getline(prescription,50);
cout<<endl;
cout<<"Treatment given: "<<endl;
cin.getline(treatment,50);
cout<<"Date of treatment is :";
cout<<"day/";
cin>>day;
cout<<"month/";
cin>>month;
cout<<"year/";
cin>>year;
}
void hospital::clinic::eye_clinic::display_info()
{
cout<<"Patient's name: "<<p_name<<endl;
cout<<"Examination:"<<examination<<endl;
cout<<"Prescription :"prescription<<endl;
cout<<"Treatment offered:"<<treatment<<endl;
cout<<"Date:"<<day<<"/"<<month<<"/"<<year<<endl;
}
void hospital::clinic::dematological::get_info()
{
cout<<"patient's name";
cin.getline(p_name,20);
cout<<"examination"<<endl;
cin.getline(examination,50);
cout<<"Doctor's prescription :"<<endl;
cin.getline(prescription,50);
cout<<endl;
cout<<"Treatment given: "<<endl;
cin.getline(treatment,50);
cout<<"Date of treatment is :";
cout<<"day/";
cin>>day;
cout<<"month/";
cin>>month;
cout<<"year/";
cin>>year;
}
void hospital::clinic::dematological::display_info()
{
cout<<"Patient's name: "<<p_name<<endl;
cout<<"Examination:"<<examination<<endl;
cout<<"Prescription :"prescription<<endl;
cout<<"Treatment offered:"<<treatment<<endl;
cout<<"Date:"<<day<<"/"<<month<<"/"<<year<<endl;
}
void hospital::pharmacy::get_info()
{
cout<<"Enter the name of the patient: ";
cin>>p_name;
cout<<"Enter the name of the doctor who prescribed the drug :";
cin>>doctor;
cout<<"Enter the name of the drug prescribed :";
cin>>d_name;
cout<<"Enter the price ofthe drug:";
cin>>price;
}
void hospital::pharmacy::display_info()
{
cout<<"Patient's name: "<<p_name;
cout<<"Doctor's name: "<<doctor;
cout<<"Drug prescribed: "<<d_name;
cout<<"Drug price: "<<price;
}
void hospital::laboratory::get_info()
{
cout<<"Enter the name of the patient: ";
cin>>p_name;
cout<<"Enter the type of test conducted: ";
cin.getline(test,50);
cout<<"Results of the test done are:";
cin.getline(result,50);
}
int hospital::laboratory::labbill()
{
for(const int standing_test_fee = 1000);
labfee=standing_test_fee + fee;
cout<<"Enter the fee for the test done:";
cin>>fee;
labfee=standing_test_fee + fee;
cout<<"The total lab fee for the test done :"<<labfee;
}
void hospital::laboratory::display_info()
{
cout<<"Patient's name: "<<p_name<<endl;
cout<<"Type of test done is :"<<test<<endl;
cout<<"Results of the test done: "<<results<<endl;
cout<<"The fee for the test done is: "<<labfee<<endl;
}
void hospital::ward::get_ward()
{
cout<<"Enter the name of the patient: ";
cin.getline(p_name,20);
if (int age <=18)
{
cout<<"Admit the patient to the paediatric ward:";
}
else
{
cout<<"Admit to the adults ward";
cout<<"Enter the age of the patient: ";
cin>>age;
}
}
void hospital::ward::display_info()
{
cout<<"Patient's name: "<<p_name;
cout<<"Age: "<<age;
if(age<=18)
{
cout<<"This patient is admitted in the paediatric ward: ";
}
else
{
cout<<"This patient is admitted in the Adults ward: ";
}
}
void hospital::ward::paediatric::get_info()
{
cout<<"Enter the patient's name: ";
cin.getline(p_name,20);
cout<<"Enter the ward number: ";
cin>>wardno;
cout<<"Enter the bed number: ";
cin>>bedno;
cout<<"Enter the date of admission:";
cout<<"day";
cin>>day;
cout<<"month";
cin>>month;
cout<<"year";
cin>>year;
}
int hospital::ward::paediatric::wardbill()
{
cout<<"Is the patient in a private ward?(N/Y)";
cin>>select;
if(select==N);
standingward_fee=2000;
else
standingward_fee=1000;
const int bedfee=300;
const int mealfee=250;
int no_days;
cout<<"Enter the number of days: ";
cin>>no_days;
wardbill= ((bedfee+mealfee)*no_days)+standingward_fee;
void hospital::ward::paediatric::display_info()
{
cout<<"Patient's name: "<<p_name;
cout<<"Ward number: "<<wardno;
cout<<"Bed number: "<<bedno;
cout<<"Date of admission: "<<day<<"/"<<month<<"/"<<year;
cout<<"Ward fee: "<<wardbill;
}
void hospital::ward::adult::get_info()
{
cout<<"Enter the patient's name: ";
cin.getline(p_name,20);
cout<<"Enter the patient's sex:(M/F)";
cin>>sex;
cout<<"Ward: ";
if(sex==M);
ward=="Male ward";
else
ward=="Female ward";
cout<<ward;
cout<<"Enter the ward number: ";
cin>>wardno;
cout<<"Enter the bed number: ";
cin>>bedno;
cout<<"Enter the date of admission:";
cout<<"day";
cin>>day;
cout<<"month";
cin>>month;
cout<<"year";
}
int hospital::ward::adult::wardbill()
{
ut<<"Is the patient in a private ward?(N/Y)";
cin>>select;
if(select==N);
standingward_fee=2000;
else
standingward_fee=1000;
cout<<"Enter the number of days: ";
cin>>no_days
const int bedfee=300;
const int mealfee=250;
wardbill= ((bedfee+mealfee)*no_days)+standingward_fee;
}
void hospital::ward::adult::display_info()
{
cout<<"Patient's name: "<<p_name;
cout<<"Sex: "<<sex;
cout<<"Ward: "<<ward;
cout<<"Ward number: "<<wardno;
cout<<"Bed number: "<<bedno;
cout<<"Date of admission: "<<day<<"/"<<month<<"/"<<year;
cout<<"Ward fee: "<<wardbill;
}
void hospital::maternity::get_info()
{
cout<<"Enter the name of the patient: ";
cin.getline(p_name,20);
cout<<"Enter the name of the doctor who performed the delivery:";
cin.getline(doctor,20);
cout<<"Enter the status of the birth process: ";
cin.getline(birth_status,20);
cout<<"Enter the sex of the baby: ";
cin>>baby_sex;
cout<<"Enter the date of birth";
cout<<"day";
cin>>day;
cout<<"month";
cin>>month;
cout<<"year";
}
int hospital::maternity::wardfee()
{
cout<<"Is the patient in a private ward?(N/Y)";
cin>>select;
if(select==N);
standingward_fee=2000;
else
standingward_fee=1000;
const int bedfee=300;
const int mealfee=250;
int no_days;
cout<<"Enter the number of days: ";
cin>>no_days
wardbill= ((bedfee+mealfee)*no_days)+standingward_fee;
}
void hospital::maternity::display_info()
{
cout<<"Patient's name: "<<p_name<<endl;
cout<<"Doctor's name: "<<doctor;,,endl;
cout<<"Birth status: "<<birth_status<<endl;
cout<<"Sex of the baby: "<<baby_sex<<endl;
cout<<"Date of delivery: "<<day<<"/"<<month<<"/"<<year<<endl;
cout<<"Maternity ward fee: "<<wardbill;
}
void hospital::icu::get_info()
{
cout<<"Enter the name of the patient: ";
cin.getline(p_name,20);
cout<<"Enter the emergency reason: ";
cin>>examination;
cout<<"Enter ther date of admission: ";
cout<<"day";
cin>>day;
cout<<"month";
cin>>month;
cout<<"year";
}
int hospital::icu::icu_fee()
{
standingward_charge=5000;
cout<<"Enter the medicalfee:";
cin>>medicalfee;
cout<<"Enter the number of hours spent in the icu:";
cin>>no_hours;
icubill=(standingward_charge * no_hours)+medicalfee;
}
void hospital::icu::display_info()
{
cout<<"Patient's name: "<<p_name<<endl;
cout<<"Emergency state:"<<examination<<endl;
cout<<"Date of admission: "<<day<<"/"<<month<<"/"<<year<<endl;
cout<<"Standingcharge for the ICU: "<<standingward_charge<<endl;
cout<<"Medical fee: "<<medicalfee<<endl;
cout<<"Total ICU bill = "<<icubill;
}
int hospital::finance_billing::bill(int)
{
ccut<<"Enter the total ward bill:";
cin>>wardbill;
cout<<"Enter the total lab fee: ";
cin>>labfee;
cout<<"Enter the total ICU fee: ";
cin>>icufee;
t_bill = wardbill + labfee + icubill;
}
void hospital::finance_billing::display_info()
{
cout<<"Ward fee = "<<wardfee;
cout<<"Laboratory fee = "<<labfee;
cout<<"Intensive care unit fee = "<<icufee;
cout<<"Total bill = "<<t_bill<<<endl;
}
void hospital::menu()
{
cout<<"H¬hospital."<<endl;
cout<<"R¬reception."<<endl;
cout<<"C¬clinic."<<endl;
cout<<"D¬dental."<<endl;
cout<<"E¬eye_clinic."<<endl;
cout<<"S¬dematological."<<endl;
cout<<"P¬pharmacy."<<endl;
cout<<"L¬laboratory."<<endl;
cout<<"W¬ward."<<endl;
cout<<"K¬paediatrics."<<endl;
cout<<"A¬adults."<<endl;
cout<<"M¬maternity."<<endl;
cout<<"I¬ICU."<<endl;
cout<<"F¬finance_billing."<<endl;
}
void main(void)
{
class hospital hosp;
char option;
hosp.menu();
while((option=cin.get())!='q');
}
switch(option)
{
case 'H':
hospital();
break;
case 'R':
reception();
break;
case 'C':
clinic();
break;
case 'D':
dental();
break;
case 'E':
eye_clinic();
break;
case 'S':
dematological();
break;
case 'P':
pharmacy();
break;
case 'L':
laboratory();
break;
case 'W':
ward();
break;
case 'K':
paediatric();
break;
case 'A':
adult();
break;
case 'M':
maternity();
break;
case 'I':
icu();
break;
case 'F':
finance_billing();
break;
}