Hi everyone,
Following is the C++ code that am stuck with at runtime:
When I compile(Dev C++ compiler) and run, "Please enter the course name" (without quotes) gets printed however the displaymessage function does NOT get printed. I've deliberately kept the parameter list name to nameofcourse at both places to avoid confusion.Code:#include <iostream> #include <string> using namespace std ; class gradebook { public: void displaymessage (string nameofcourse) { cout << "Welcome to the Gradebook for\n" << nameofcourse ; } } ; int main () { string nameofcourse ; cout << "Please enter the course name\n\n" ; getline(cin, nameofcourse) ; cin.get () ; gradebook mygradebook ; mygradebook.displaymessage (nameofcourse) ; return 0 ; }
Please help