Question: #include #include using namespace std; class Patient { public: void SetNameAndAge(string newName, int newAge); int GetAge() const; void Print() const; private: string name; int age;

 #include #include using namespace std; class Patient { public: void SetNameAndAge(string

#include #include using namespace std;

class Patient { public: void SetNameAndAge(string newName, int newAge); int GetAge() const; void Print() const; private: string name; int age; };

void Patient::SetNameAndAge(string newName, int newAge) { name = newName; age = newAge; }

int Patient::GetAge() const { return age; }

void Patient::Print() const { cout

int main() { int patientCount; unsigned int i; vector patientList; Patient currPatient; string currName; int currAge;

cin >> patientCount; for (i = 0; i > currName; cin >> currAge; currPatient.SetNameAndAge(currName, currAge); patientList.push_back(currPatient); }

/* Your code goes here */

return 0; }

Jump to level 1 The program first reads integer patientCount from input, representing the number of pairs of inputs to be read. Each pair has a string and an integer. One Patient object is created for each pair and added to vector patientList. If a Patient object's age is between 27 and 61 , both inclusive, call the Patient object's Print(). Ex: If the input is: 4 Jan 87Tim25 Ina 27 Mel 61 then the output is: Patient: Ina, Age: 27 Patient: Mel, Age: 61 Note: The vector has at least one element

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!