主题:c++转换问题
#include <iostream>
using std ::cout;
using std :: cin;
using std ::endl;
#include <string>
using std ::string;
using std ::getline;
class GradeBook
{
public:
void setCourseName(string name)
{ courseName=name;}
string getCourseName()
{ return courseName;}
void displayMessage()
{ cout<<"welcome to the GradeBook"<<getCourseName()<<endl;}
private :
string courseName;
}
main()
{
string nameofCourse;
GradeBook myGradeBook;
cout<<"Initial course name is:"<< myGradeBook .getCourseName()<<endl;
cout<<"\nplease enter coursename:"<<endl;
getline(cin,nameofCourse);
myGradeBook.setCourseName(nameofCourse);
cout<<endl;
myGradeBook .displayMessage();
}error C3874: “main”的返回类型应为“int”而非“GradeBook”
我不知道怎么办 谢谢各位大哥多多指点
using std ::cout;
using std :: cin;
using std ::endl;
#include <string>
using std ::string;
using std ::getline;
class GradeBook
{
public:
void setCourseName(string name)
{ courseName=name;}
string getCourseName()
{ return courseName;}
void displayMessage()
{ cout<<"welcome to the GradeBook"<<getCourseName()<<endl;}
private :
string courseName;
}
main()
{
string nameofCourse;
GradeBook myGradeBook;
cout<<"Initial course name is:"<< myGradeBook .getCourseName()<<endl;
cout<<"\nplease enter coursename:"<<endl;
getline(cin,nameofCourse);
myGradeBook.setCourseName(nameofCourse);
cout<<endl;
myGradeBook .displayMessage();
}error C3874: “main”的返回类型应为“int”而非“GradeBook”
我不知道怎么办 谢谢各位大哥多多指点