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
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
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 elementStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started