hw7_main.cpp
/* Programmer: Jennifer Leopold
Date: March 4, 2016
File: hw7_main.cpp
Purpose: Program that simulates a healthcare clinic
where patients come in with a complaint, and are
prescribed a remedy and charged for the visit.
To compile: fg++ hw7_main.cpp hw7_functs.cpp -o hw7
To execute: ./hw7
*/
#include <iostream>
#include <ctime>
#include <cstdlib>
#include "hw7_functs.h"
using namespace std;
int main()
{
patient patients[MAX_NUM_PATIENTS]; // list of patients seen
int patientCount = 0; // actual # patients seen
char response; // y/n response for "more
// patients?" question
// Greet user
cout << "\nWelcome to Cletus' Healthcare Clinic\n";
// Seed the random number generator
srand(time(NULL));
// Allow the user to repeatedly admit patients until
// s/he says there are no more or max # patients have
// been seen for the day
do
{
response =
getYNInput("\nDoes anyone need to see the doc(y/n)? ");
if (response == 'Y')
{
patients[patientCount] = makeRandomPatient();
printPatient(patients[patientCount]);
patientCount++;
}
if (patientCount == MAX_NUM_PATIENTS)
cout << "\nGeez, enuff is enuff! "
<< "We've seen our limit for the day!\n"
<< "I'm going fishin'...\n";
} while ((response == 'Y') &&
(patientCount < MAX_NUM_PATIENTS));
// Sort patient array by patient name
sortPatientArray(patients, patientCount);
// Output list of patients
printPatientArray(patients, patientCount);
// Sign-off
cout << "\nCletus' Healthcare Clinic is now closed!\n";
return 0;
}