Hi. I have wrote a Hangman program. It is all working fine, but there is one issue. I want the user to have 5 "tries" before the program stops. The "tries" are only decreasing if the user puts the wrong letter into it. Now though the "tries" are based on the length of the word. And either if it is a wrong or right letter the "tries" are decreasing. How can i change the "tries" to 5 and make it only decreasing when there is a wrong input? Sorry for my bad english..
I think I would look where tries is incremented. Only increment when a guess is wrong. At line 61 you have an if statement that determines if a guess is correct. How could you use this to increment tries only if the guess is incorrect?
All things are lawful, but not all things are profitable.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop