我对 C++ 完全陌生,我创建了这个函数:
bool guessWord(string compWord)
{
cout << "Guess a letter: ";
string userLetter;
cin >> userLetter;
for (unsigned int x = 0; x < compWord.length(); x++)
{
string compLetter = compWord[x];
if (compLetter == userLetter)
{
return true;
}
}
return false;
}
但它返回到以下error: invalid conversion from 'char' to 'const char*' [-fpermissive]
。谁能帮我理解这意味着什么?