You are on page 1of 4

#include <iostream>

#include <conio.h>
#include <string>
using namespace std;

struct Patients
{
string P_name;
int P_age;
long P_Number;
string P_Disease;
string Symptom1;
string Symptom2;
string Symptom3;
string History;
string Condition;
string Doc_Assigned_Name;
string Medicine_Diagnosed;
string Appointment_Number;
};

struct Doctor
{
string D_Name;
string D_Speciality;
string D_Experience;
int D_age;
string D_Appointment_No;
};

Patients Pat[10];
Doctor Doc[3];
string Diseases[3];

void Patient_Info();
void Doctors_Info();
void Disease_Diagnosed();
void Doctor_Diagnosed();
void Medicines();
void Output_Diagnosis();

int main()
{
Patient_Info();
Doctors_Info();
Disease_Diagnosed();
Doctor_Diagnosed();
Medicines();
Output_Diagnosis();
}

void Patient_Info()
{
for (int i = 0; i < 3; i++)
{
cout << "Enter patient's name: ";
cin >> Pat[i].P_name;
cout << "Enter patient's age: ";
cin >> Pat[i].P_age;
cout << "Enter patient's number: ";
cin >> Pat[i].P_Number;
cin.ignore();
cout << "Enter symptom number 1" << " : ";
getline(cin,Pat[i].Symptom1);
cout << "Enter symptom number 2" << " : ";
getline(cin, Pat[i].Symptom2);
cout << "Enter symptom number 3" << " : ";
getline(cin, Pat[i].Symptom3);
cout << "Enter Patient's disease history (Previous disease name (if
any) & Number of years/months that it lasted): ";
getline(cin, Pat[i].History);
cout << "Enter patient's condition (Weak/Good/Satisfactory): ";
cin >> Pat[i].Condition;
}
}

void Doctors_Info()
{
Doc[0].D_Name = "Dr. Muhammad Zubair";
Doc[0].D_age = 25;
Doc[0].D_Appointment_No = "MZB-123";
Doc[0].D_Experience = "5 years";
Doc[0].D_Speciality = "Heavy Fever";
Doc[1].D_Name = "Dr. Ruth Pao";
Doc[1].D_age = 25;
Doc[1].D_Appointment_No = "RPO-123";
Doc[1].D_Experience = "3 years";
Doc[1].D_Speciality = "Cardiac Arrest";
Doc[2].D_Name = "Dr. Samar Mubarak";
Doc[2].D_age = 25;
Doc[2].D_Appointment_No = "SMB-123";
Doc[2].D_Experience = "3 years";
Doc[2].D_Speciality = "Viral Flu";
}

void Disease_Diagnosed()
{
for (int i = 0; i < 3; i++)
{
if (Pat[i].Symptom1 == "Vomiting" && Pat[i].Symptom2 == "Headache" &&
Pat[i].Symptom3 == "Dizziness")
Pat[i].P_Disease = "Heavy Fever";
else if (Pat[i].Symptom1 == "Chest Pain" && Pat[i].Symptom2 == "Heavy
Breathing" && Pat[i].Symptom3 == "High BP")
Pat[i].P_Disease = "Cardiac Arrest";
else if (Pat[i].Symptom1 == "Throat Pain"&&Pat[i].Symptom2 == "Running
Nose"&&Pat[i].Symptom3 == "Headache")
Pat[i].P_Disease = "Viral Flu";
}
}

void Doctor_Diagnosed()
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (Pat[i].P_Disease == Doc[j].D_Speciality)
{
Pat[i].Doc_Assigned_Name = Doc[j].D_Name;
Pat[i].Appointment_Number = Doc[j].D_Appointment_No;
}
}
}
}

void Medicines()
{
for (int i = 0; i < 3; i++)
{
if (Pat[i].P_Disease == "Heavy Fever")
Pat[i].Medicine_Diagnosed = "Heavy Biotics";
else if (Pat[i].P_Disease == "Light fever")
Pat[i].Medicine_Diagnosed = "Paracetamol";
else if (Pat[i].P_Disease == "Cardiac Arrest")
Pat[i].Medicine_Diagnosed = "CT Scan";
else if (Pat[i].P_Disease == "Viral Flu")
Pat[i].Medicine_Diagnosed = "Antibiotics";
}
}

void Output_Diagnosis()
{

cout << "=====================================\n";


for (int i = 0; i < 3; i++)
{
cout << "Patient name is: " << Pat[i].P_name << "\n";
cout << "Patient age is: " << Pat[i].P_age << "\n";
cout << "Patient contact number is: " << Pat[i].P_Number << "\n";
cout << "Patient diagnosed disease is: " << Pat[i].P_Disease <<
"\n";
cout << "Patient history is: " << Pat[i].History << "\n";
cout << "Patient condition is: " << Pat[i].Condition << "\n";
cout << "Patient's appointment number is: " <<
Pat[i].Appointment_Number << "\n";
cout << "Patient diagnosed doctor name is: " <<
Pat[i].Doc_Assigned_Name << "\n";
for (int j = 0; j < 3; j++)
{
if (Pat[i].Doc_Assigned_Name == Doc[j].D_Name)
{
cout << "Patient's doctor's age is: " << Doc[j].D_age
<< "\n";
cout << "Patient's doctor's experience is: " <<
Doc[j].D_Experience << "\n";
cout << "Patient's doctor's speciality is: " <<
Doc[j].D_Speciality << "\n";
cout << "Recommended medicine for patient is: " <<
Pat[i].Medicine_Diagnosed << "\n";
}
}
cout << "=====================================\n";
}
cout << "=====================================\n";
}

You might also like