// Fig 3.3 from D & D // Scott Emrich // This is a slightly more complex CC++ program introducing classes #include using std::cout; using std::cin; using std::endl; #include // here we will use standard template strings using std::string; using std::getline; // more later // A GradeBook class with slightly more bells and whistles class GradeBook { public: void displayMessage(string courseName) { // note we can submit objects as // function parameters cout << "Welcome to the grade book for:\n" << courseName << endl; } }; int main () { string CourseName; // create a courseName for the program GradeBook myGradeBook; // create a gradebook object // ask the user for his name cout << "Please enter the course name: " << endl; // getline reads in all data until the \n. and truncates it getline (cin, CourseName); cout << endl; // output the received name myGradeBook.displayMessage(CourseName); return (0); // yay!! }