Here is my code
#include<iostream>
#include<string>
using namespace std;
class GradeBook; // GradeBook class definition
{
public:
// constructor initializes courseName
GradeBook(string name)
{
setCourseName(name);
}
void setCourseName(string name)
{
courseName = name;
}
string getCourseName()
{
return courseName;
}
void displayMessage()
{
cout << "Welcome to the grade book for\n" << getCourseName() << "!" << endl;
}
private:
string courseName;
};
int main()
{
GradeBook gradeBook1("CS101 Introduction to C++ Programming");
GradeBook gradeBook2("Visual C++ introduction");
cout << "gradeBook1 created for course: " << gradeBook1.getCourseName()
<< "\ngradeBook2 created for course: " << gradeBook2.getCourseName()
<< endl;
return 0;
}
答案 0 :(得分:0)
在;
之后删除class Gradebook
,一切都会好的。