Question: C++ Please! Just fill in where it says /* Your code goes here */ Use currCertificate's ReadHolderAndDivision() to read each pair of inputs,
C++ Please! Just fill in where it says " /* Your code goes here */ "
Use currCertificate's ReadHolderAndDivision() to read each pair of inputs, string holder and character division, until "stop" is read from input and currCertificate's ReadHolderAndDivision() returns false. If currCertificate's ReadHolderAndDivision() returns true, append currCertificate to vector certificateList.
Ex: If the input is Tim B Rob A Eli A Zoe A Kai B stop, then the output is:
Certificate: Tim, Division: B
Certificate: Rob, Division: A
Certificate: Eli, Division: A
Certificate: Zoe, Division: A
Certificate: Kai, Division: B
Code:
#include
class Certificate { public: bool ReadHolderAndDivision(); void Print() const; private: string holder; char division; };
bool Certificate::ReadHolderAndDivision() { string newHolder; cin >> newHolder; if (newHolder == "stop") { return false; } else { holder = newHolder; cin >> division; return true; } }
void Certificate::Print() const { cout << "Certificate: " << holder << ", Division: " << division << endl; }
int main() { unsigned int i; vector
/* Your code goes here */
for (i = 0; i < certificateList.size(); ++i) { currCertificate = certificateList.at(i); currCertificate.Print(); } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
