'c++ keep getting fpermissive error in function calls
I keep getting an fpermissive error in my code where i call the functions im not sure why. the two errors are: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
132 | playGame(winnerWord, wordArray);
error: invalid conversion from ‘char’ to ‘char*’ [-fpermissive] 90 | buildResult(guess, winWord);
Im pretty new to C++ so im not sure what to do, any help is greatly appreciated.
void playGame(char winWord, string arr[2315]) {
string guessWord;
cout << "Ok. I am thinking of a word with 5 letters." << endl;
cout << "What word would you like to guess?" << endl;
getline(cin, guessWord);
while (verifyExists(guessWord, arr) == 2)
{
cout << "The word: " << guessWord << " is not in the word list" << endl;
getline(cin, guessWord);
}
while (verifyExists(guessWord, arr) == 3)
{
cout << "You must enter a word that is 5 letters in length: " << endl;
getline(cin, guessWord);
}
cout << guessWord << endl;
char guess[5];
for (int i = 0; i < 5; i++)
{
guess[i] = guessWord[i];
}
buildResult(guess, winWord);
}
int main() {
string wordArray[2315];
ifstream myfile ("proj1_data.txt");
cout << " Welcome to UMBC Wordle" << endl;
if (myfile.is_open())
{
string word;
int loop = 0;
while (getline(myfile, word))
{
wordArray[loop++] = word;
}
cout << " " << endl;
cout << " Your file was imported!" << endl;
cout << " 2315 Words imported" << endl;
cout << " " << endl;
myfile.close();
}
srand(time(0));
string chosenWord = wordArray[rand() % 2315];
char winnerWord[5];
for (int i = 0; i < 5; i++)
{
winnerWord[i] = chosenWord[i];
}
playGame(winnerWord, wordArray);
return 0;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
