Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include "patient.cpp"
- using namespace std;
- const int TOT_PATIENTS = 16;
- void Part1();
- int main(){
- //Part1(); //Do the first part of the assignment
- ifstream inPatients;
- inPatients.open("mp7transplant2.dat");
- int pat_count = 0;
- patient pat_array[TOT_PATIENTS];
- while(inPatients && !inPatients.eof()){
- pat_array[pat_count].GetPData(inPatients);
- pat_array[pat_count].PrintPatientData();
- pat_count++;
- }
- ifstream inKidneys;
- inKidneys.open("mp7kidneys.dat");
- int match_index;
- bool matches[TOT_PATIENTS];
- string thisKid;
- while(inKidneys && !inKidneys.eof()){
- inKidneys >> thisKid;
- cout << "New Kidney Available! Finding possible matches: " << endl;
- for (int i = 0; i <= pat_count; i++){
- matches[i] = false;
- if (pat_array[i].GetBloodType().compare(thisKid)){
- cout << "Match Found!: " << endl;
- pat_array[i].PrintPatientData();
- matches[i] = true;
- }
- }
- }
- cout << "Total Patients: " << pat_count + 1 << endl;
- return 0;
- }
- void Part1(){
- ifstream inFile;
- inFile.open("mp7transplant1.dat");
- patient patient1;
- patient patient2;
- patient patient3;
- patient1.PrintPatientData();
- patient2.GetPData(inFile);
- patient3.GetPData(inFile);
- patient2.PrintPatientData();
- patient3.PrintPatientData();
- cout << "Patient 2's Blood Type is: "
- << patient2.GetBloodType() << endl << endl;
- inFile.clear();
- inFile.close();
- }
Add Comment
Please, Sign In to add comment