string word;
char knownLetters[]; // The word could be of any length
int stages = 6; // Our hangman has 6 stages, so the player starts with 6 lives
bool running = 1;
int main()
{
char userGuess
ofstream myfile ("WordBank.txt");
if (myfile.is_open() )
{
do
{
myfile << endl;
myfile.close();
cout << "Guess a letter: ";
cin >> userGuess;
bool correct = 0;
for(int pos = 0; pos < 15; pos++) {
if(userGuess == word[pos]) {
knownLetters[pos] = userGuess; // If the letter is in the word, mark it as guessed
correct = 1;
}
}
if(correct == 0) stages--; // If the letter was wrong, subtract a life
correct = 0;
printStage();
PrintLetters();
while(running)
}
return 0;
}
cout << "a word could not be found in the word bank, or it does not exist.";
return 0;
}
i was also given the parameters of using an array to switch lowercase inputs to uppercase, and to create an array for the inputs that match the wordbank pool.