Tôi gặp phải lỗi ": id không được yêu cầu trước khi '{' mã thông báo" trên dòng 6.Lỗi C++: dự kiến không đủ tiêu chuẩn-id
Tôi không thể nói điều gì sai.
#include <iostream>
using namespace std;
class WordGame;
{
public:
void setWord(string word)
{
theWord = word;
}
string getWord()
{
return theWord;
}
void displayWord()
{
cout << "Your word is " << getWord() << endl;
}
private:
string theWord;
}
int main()
{
string aWord;
WordGame theGame;
cin >> aWord;
theGame.setWord(aWord);
theGame.displaymessage();
}