119k views
0 votes
Write the InputCertificates() function in the RecordsManager class. Within InputCertificates(), use cin to read each entry number until -99 is read from input. If the entry number is not equal to -99, use the Certificate object's ReadDetails() to read the certificate's level and holder from input and append the Certificate object to vector certificateList.

1 Answer

4 votes

Final answer:

The student's question involves writing a C++ function named InputCertificates() in a RecordsManager class, to read certificate details and store them until a sentinel value is entered.

Step-by-step explanation:

The student is asking for help with writing a function in C++ as part of a class named RecordsManager. This function, InputCertificates(), is intended to collect inputs for Certificate entries and store them in a vector until a sentinel value of -99 is reached. Assuming you have a class named Certificate with a member function ReadDetails() that reads the certificate's level and holder, the implementation of InputCertificates() involves using a while loop in conjunction with the standard input stream (cin) to collect certificate details.



I will demonstrate how to write this function assuming the necessary member variables and Certificate class are properly defined:


class RecordsManager {
private:
vector

certificateList;

public:
void InputCertificates() {
int entryNumber;
cin >> entryNumber;
while (entryNumber != -99) {
Certificate newCertificate;
newCertificate.ReadDetails();
certificateList.push_back(newCertificate);
cin >> entryNumber;
}
}
};

User Taylor Lopez
by
7.3k points