Member Avatar for creck

hi, i would like to ask you to help me 'cause i am pretty new in programming and idk what's wrong with that :/ i am still getting an error that " 'main' must return 'int' "...thanks

#include<iostream>
#include<string>

using namespace std;

class GradeBook
{
      public:
             void displayMessage(string courseName){
                  cout<<"Welcome to the grade book of \n" <<courseName<<"!"<<endl;
                  }
}

int main(){
    string courseName;
    GradeBook myGradeBook;
    
    cout<<"Please Enter the course name: "<<endl;
    getline(cin, courseName);
    cout<<endl;
    
    myGradeBook.displayMessage(courseName);
    system("pause");
    return 0;
}

Class definitions end with a semicolon. Yours does not, and the compiler is interpreting that as a part of the return type for main.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.