CONTENTS
CERTIFICATE………….. I
ACKNOWLEDGEMENT…………..
II
PREFACE…………………….
III
1.HOSPITAL MANAGEMENT……… 2
2.SOURCE CODE………… 5
3.OUTPUT……….. 21
4.BIBILIOGRAPHY…………………… 28
2
PREFACE
We are moving into an information age.More and more,day by
day,we are getting influenced by technology.Infact,today’s
technology is shaping our work pattern.
Till now we had used manual records to maintain the
details.But now according to the changing technology we have
to use computerized records for more safety and security.
My project on HOSPITAL MANAGEMENT will help the
hospitals to maintain their patient and doctor records.It will
definitely satisfies the need of an user.
This program needs Turbo c++ and windows operating system
to execute.
This project includes “DATA FILE HANDLING”concept.
I had used two files to maintain the records of patients and
doctors.
It will carry out several operations which are helpful to a
hospital.
I hope this project will meet your expectations and prove more
useful and helpful to the hospitals.
3
HOSPITAL MANAGEMENT
3.VOID P_INPUT();
4.VOID P_OUTPUT();
5.VOID MODIFY(INT);
6.VOID INFO(INT);
7.VOID DETAILS1(INT);
8.VOID DETAILS2(INT);
9.VOID DELETE(INT);
10.VOID BILLING(INT);
voidp_input();
voidp_output();
voidD_input();
voidD_output();
void modify(int);
void info(int);
void billing(int);
void details1(int);
void details2(int);
void Delete(int);
class doctor
{
private:
char name[30];
intdocid;
float fees;
charspecialisation[30];
public:
gets(name);
cout<<"enter ID number of the doctor";
cin>>docid;
cout<<"enter specialisation of the doctor";
gets(specialisation);
cout<<"enter fees per consultation";
cin>>fees;
}
};
doctor d;
class patient
7
{
private:
char name[30];
char ailment[20];
int age;
inti,j;
intdate,month,year;
char gender;
introomno,noofdays;
char ward[20];
char medicines[30][10];
float cost[30];
float bill;
public:
intdocid,adno;
cin>>noofdays;
if(age>11)
{
cout<<"enter gender";
cin>>gender;
if(gender=='f'||gender=='F')
{
strcpy(ward,"female ward");
}
if(gender=='m'||gender=='M')
{
strcpy(ward,"male ward");
}
}
else
{
strcpy(ward,"children ward");
}
}
cout<<"enter ailment";
gets(ailment);
cout<<"enter date(dd/mm/yy)";
cin>>date>>month>>year;
cout<<"enter no of medicines to buy";
cin>>j;
int a;
for(a=0;a<j;a++)
{
cout<<"enter the name of the medicine";
cin>>medicines[a];
cout<<"enter cost of the medicine";
cin>>cost[a];
bill+=cost[a];
} //end of for
9
} //end of function
int b;
for(b=0;b<j;b++)
{
cout<<medicines[b]<<"\t\t"<<cost[b]<<"\n";
}//end of for
cout<<"\n**********************\n";
} //end of function
bill+=fees;
return bill;
}
else
{
return bill;
}
} //end of function
class hospital
{
private:
charhname[35];
char address[80];
public:
} //end of function
patient p;
hospital h;
//**********************************************
*
//**********************************************
***
//**********************************************
**
//**********************************************
//**********************************************
while(inout.read((char*)&p,sizeof(p)))
{
if(p.return_adno()==n)
{
p.showpatient();
intpos=-1*sizeof(p);
inout.seekp(pos,ios::cur);
cout<<"enter new details of the patient";
p.getpatient();
inout.write((char*)&p,sizeof(p));
cout<<"new details of the patient are:";
p.showpatient();
}//end of if
} //end of while
inout.close();
} //end of function
//*******************************************
bill=p.bills();
cout<<"bill of the patient:"<<bill;
break;
}//end of if
} //end of while
in.close();
} //END OF FUNCTION
//******************************************
//**********************************************
******
//**********************************************
*****
while(in.read((char*)&d,sizeof(d)))
{
if(d.return_docid()==docid)
{
16
//**********************************************
*************
void Delete(int n)
{
ifstream in;
in.open("patient.dat",ios::in|ios::binary);
ofstream out;
out.open("pat.dat",ios::out|ios::binary);
fstreaminout;
inout.open("DELETEd_rec.dat",ios::in|ios::ou
t|ios::binary|ios::app);
intpos,flag=0;
while(in.read((char*)&p,sizeof(p)))
{
if(p.return_adno()==n)
{
inout.write((char*)&p,sizeof(p));
flag=1;
}
else
{
out.write((char*)&p,sizeof(p));
}
}
in.close();
out.close();
17
remove("patient.dat");
rename("pat.dat","patient.dat");
cout<<"\nRECORD DELETED\n";
ifstream fin;
in.open("PATIENT.dat",ios::in|ios::binary);
int rec=0;
while(fin.read((char*)&p,sizeof(p)))
{
rec++;
}
cout<<"\nno.of records in the present file";
cout<<rec;
in.close();
if(flag==1)
cout<<"record found";
else
cout<<"\nnot found";
inout.close();
} //end of function
//**********************************************
************
void main()
{
clrscr();
inti,n;
h.show();
char a='y';
int j;
while(a=='y'||a=='Y')
{
cout<<"enter your choice";
cout<<"\n1.TO ENTER DETAILS OF THE DOCTOR";
18
case 2:
clrscr();
D_output();
break;
case 3:
clrscr();
p_input();
break;
case 4:
clrscr();
p_output();
break;
case 5:
clrscr();
cout<<"enter adno of the patient";
cin>>n;
19
modify(n);
break;
case 6:
clrscr();
cout<<"enter adno of the patient";
cin>>n;
billing(n);
break;
case 7:
clrscr();
cout<<"enter docid";
cin>>n;
info(n);
break;
case 8:
clrscr();
cout<<"enter adno of the patient";
cin>>n;
details1(n);
break;
case 9:
clrscr();
cout<<"enter adno of the patient";
cin>>n;
Delete(n);
break;
default:
clrscr();
cout<<"enter correct choice";
main();
20
}
cout<<"\n\nyou want to continue(y/n)\n";
cin>>a;
}
getch();
}
//*********************THE END*****************
OUTPUT:-
21
22
23
24
25
26
27
28
BIBILLIOGRAPHY