#include #include using namespace std; #include "prompt.h" class Student { public: Student(const string& name); void RespondTo( /* question needed here */); int Score() const; string Name() const; private: string myName; int myCorrect; }; Student::Student(const string& name) : myName(name), myCorrect(0) { // initializer list does the work } void Student::RespondTo( /* question needed here */) { string answer; cout << "type answer after question " << endl << endl; cout << "what is your favorite color? "; cin >> answer; if (answer == "blue") { cout << "that is correct" << endl; myCorrect++; } else { cout << "No! your favorite color is blue" << endl; } } int Student::Score() const { return myCorrect; } string Student::Name() const { return myName; } int main() { string name = PromptString("enter name: "); int numQuest = PromptRange("number of questions: ",1,10); Student st(name); int k; for(k=0; k < numQuest; k++) { st.RespondTo(); // question parameter missing } cout << st.Name() << ", your score is " << st.Score() << " out of " << numQuest << endl; return 0; }