0% found this document useful (0 votes)
15 views2 pages

Hospital Management System Code

The document presents a C++ code for a simple Hospital Management System that allows users to add and display patient and doctor records. It includes functionalities for entering patient details such as name, age, and disease, as well as doctor details like name and specialization. The program runs in a loop until the user chooses to exit, providing a menu for interaction.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Hospital Management System Code

The document presents a C++ code for a simple Hospital Management System that allows users to add and display patient and doctor records. It includes functionalities for entering patient details such as name, age, and disease, as well as doctor details like name and specialization. The program runs in a loop until the user chooses to exit, providing a menu for interaction.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Hospital Management System (C++ Code)

#include <iostream>
using namespace std;

int main() {
int choice;

string patientName[50];
int patientAge[50];
string patientDisease[50];
int patientCount = 0;

string doctorName[50];
string doctorSpec[50];
int doctorCount = 0;

do {
cout << "\n===== HOSPITAL MANAGEMENT SYSTEM =====\n";
cout << "1. Add Patient Record\n";
cout << "2. Display Patient Records\n";
cout << "3. Add Doctor Record\n";
cout << "4. Display Doctor Records\n";
cout << "5. Exit\n";
cout << "Enter your choice: ";
cin >> choice;

if (choice == 1) {
cout << "\nEnter Patient Name: ";
cin >> patientName[patientCount];
cout << "Enter Patient Age: ";
cin >> patientAge[patientCount];
cout << "Enter Disease: ";
cin >> patientDisease[patientCount];
patientCount++;
cout << "Patient record added successfully!\n";
}
else if (choice == 2) {
cout << "\n--- Patient Records ---\n";
for (int i = 0; i < patientCount; i++) {
cout << "Name: " << patientName[i]
<< ", Age: " << patientAge[i]
<< ", Disease: " << patientDisease[i] << endl;
}
}
else if (choice == 3) {
cout << "\nEnter Doctor Name: ";
cin >> doctorName[doctorCount];
cout << "Enter Specialization: ";
cin >> doctorSpec[doctorCount];
doctorCount++;
cout << "Doctor record added successfully!\n";
}
else if (choice == 4) {
cout << "\n--- Doctor Records ---\n";
for (int i = 0; i < doctorCount; i++) {
cout << "Name: " << doctorName[i]
<< ", Specialization: " << doctorSpec[i] << endl;
}
}
else if (choice == 5) {
cout << "Exiting program... Thank you!\n";
}
else {
cout << "Invalid choice! Try again.\n";
}

} while (choice != 5);

return 0;
}

You might also like