To creat this C++ programme create a structure containing patient information like patient id, name of patient, disease description, doctor name and flag to know whether patient has an appointment (Stucture array of 5)
You have to
1. Add a new patient
2. Display patients that have appointment
3. Display all patients in the hospital of a particular doctor
4. Display all the patients that have appointment with a specific doctor
5. Display the total number of patients in the hospital
6. Book a appointment
(If we book an appointment, the total number of appointments increased by 1)
#include <iostream>
#include <vector>
using namespace std;
struct patient {
int id;
string name;
string description;
string doctor;
bool flag;
};
void menu()
{
cout << " MENU" << endl;
cout << "1) Add a new patient" << endl;
cout << "2) Display patients that have appointment" << endl;
cout << "3) Display all patients in the hospital of a particular doctor" << endl;
cout << "4) Display all the patients that have appointment with a specific doctor" << endl;
cout << "5) Display the total number of patients in the hospital" << endl;
cout << "6) Book a appointment" << endl;
cout << "7) Exit system" << endl;
}
void add_new();
vector<patient> list;
int main()
{
while (true) {
menu();
int n; cin >> n;
switch (n) {
case (1):
add_new();
break;
case (2):
// impl..
case (3):
// impl..
case (4):
// impl..
case (5):
// impl..
case (6):
// impl..
case (7):
exit(0);
}
}
}
void add_new()
{
patient p;
cout << "ID: ";
cin >> p.id;
cout << "Name: ";
cin >> p.name;
cout << "Description: ";
cin >> p.description;
cout << "Doctor name: ";
cin >> p.doctor;
cout << "Flag: ";
cin >> p.flag;
list.push_back(p);
cout << "Successfully added new patient" << endl;
}
Comments
Leave a comment