我得到一個錯誤「錯誤:之前的預期不合格的ID‘{’令牌」上線6C++錯誤:預期不合格-ID
我不能告訴什麼是錯的。
#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();
}