C + + Project: Submttd. By: Vaibhav Jain Class: Xii A Roll No
C + + Project: Submttd. By: Vaibhav Jain Class: Xii A Roll No
PROJECT
Class: XII A
Roll No :
TOPIC:
HOSPITAL
MANAGEMENT
CERTIFICATE
This is to certify that project entitled
“HOSPITAL MANAGEMENT”
is submitted by VAIBHAV JAIN of class
XII A bearing roll no. . This
project has been completed under my
guidance.
Ms. Vijaylaxmi
(PGT. Computer science)
CONTENTS
➢ Preface
➢ Acknowledgement
➢ Introduction
➢ Source code in C++
➢ Output
➢ Glossary
PREFACE
This project develops a basic idea on how
computers can be used to store and manage
a particular kind of data in an organization.
Through this project managing information
about the patients admitted into a hospital
will be more efficient, easy and convenient.
Records are easy to retrieve, manage and
update.
It defines :
* a structure for patient data
* a class for queue, which includes :
Member functions-
- add patient at the end
- add patient at the beginning
- get next patient
- output list
* The header files used are:
- iostream.h
- conio.h
- string.h
- stdlib.h
SOURCE CODE
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
// define maximum number of patients in a queue
#define MAXPATIENTS 100
// define structure for patient data
struct patient
{
char FirstName[50];
char LastName[50];
char ID[20];
};
// define class for queue
class queue
{
public:
queue (void);
int AddPatientAtEnd (patient p);
int AddPatientAtBeginning (patient p);
patient GetNextPatient (void);
void OutputList (void);
char DepartmentName[50];
private:
int NumberOfPatients;
patient List[MAXPATIENTS];
};
// declare member functions for queue
queue::queue ()
{
// constructor
NumberOfPatients = 0;
}
int queue::AddPatientAtEnd (patient p)
{
// adds a normal patient to the end of the queue.
// returns 1 if successful, 0 if queue is full.
if (NumberOfPatients >= MAXPATIENTS)
{
// queue is full
return 0;
}
// put in new patient
else
List[NumberOfPatients] = p; NumberOfPatients++;
return 1;
}
int queue::AddPatientAtBeginning (patient p)
{
// adds a critically ill patient to the beginning of the queue.
// returns 1 if successful, 0 if queue is full.
int i;
if (NumberOfPatients >= MAXPATIENTS)
{
// queue is full
return 0;
}
// move all patients one position back in queue
for (i = NumberOfPatients-1; i >= 0; i--)
{
List[i+1] = List[i];
}
// put in new patient
List[0] = p; NumberOfPatients++;
return 1;
}
patient queue::GetNextPatient (void)
{
// gets the patient that is first in the queue.
// returns patient with no ID if queue is empty
int i; patient p;
if (NumberOfPatients == 0) {
// queue is empty
strcpy(p.ID,"");
return p;}
// get first patient
p = List[0];
// move all remaining patients one position forward in queue
NumberOfPatients--;
for (i=0; i<NumberOfPatients; i++)
{
List[i] = List[i+1];
}
// return patient
return p;
}