#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
class GradeBook
{
public:
GradeBook(string name)
{
setCourseName(name);
}
void setCourseName(string name)
{
CourseName=name;
}
string getCourseName()
{
return CourseName;
}
void displayMessage()
{
cout<<"Welcome to Chongqing\n"<<getCourseName()<<"!"<<endl;
}
private:
string CourseName;
}
int main()
{
GradeBook gradebook1("世界你好! ");
GradeBook gradebook2("世界你好!");
cout<<"gradebook1 Created for course:"<<gradebook1.getCourseName()<<"\n gradebook2 Created for couse:"<<gradebook2.getCourseName()<<endl;
return 0;
}
D:\C++\Documents and Settings\GradeBook\fig03_17.cpp(6) : error C2628: 'GradeBook' followed by 'int' is illegal (did you forget a ';'?)
network.cpp
D:\C++\Documents and Settings\GradeBook\network.cpp(30) : error C2628: 'GradeBook' followed by 'int' is illegal (did you forget a ';'?)
Error executing cl.exe.
都说少个分号我不知道少在哪里啊.我写的两个程序都这样