I am making a wheel of fortune game and have successfully figured out how to change the word that you're trying to guess into astricks *. However, I cannot figure out how to change it back once the user inputs a correct letter.

The puzzle comes from the user inputting a file name previously in the code.

Here is my code for this segment so far:

for (int counter = 0; counter < phrase.length(); counter++)
               {
                       if (phrase[counter] = puzzle[counter])
                               puzzle[counter] = phrase[counter];

                        cout << "PUZZLE: " << phrase << endl; // for debugging purposes
               }

                        cout << "PUZZLE: " << phrase << endl;  // for debugging purposes

Can you please help clear up for me where I am going wrong?

Thank you so much for your time.

Edited 6 Years Ago by Nick Evan: Added CODE-tags

You should use two string variables: in one of them you should keep that word and in the other word changed into combinations of '*' and latters. Your code probably fail there: "if (phrase[counter] = puzzle[counter])" becouse you should use == instead of =.

Thank you for your help. That is one of my errors.

I was told to do this, " you need to compare what the user entered as a letter choice to each index of the phrase to determine if it needs to be unhidden (changed from astrick to letter) in the puzzle array" but I'm not sure how to do that. any suggestions?

Use a loop and check are the choosen letter and ith element of the word the same. If they are unhide ith element in the puzzle.

I am also working on a Wheel of Fortune game. My version lets you play against a friend across the internet. I have the internet component working, and an just starting the UI. I would share the internet code with you if you'd like to share your UI code with me. What do you think?

This article has been dead for over six months. Start a new discussion instead.