Right now I have a hangman program that runs on a while loop, using the conditions: lost, won or still playing.
This is using a manual input of a word.
I need to create a different version of this program where I would ask the player to pick between 1 and 23 (a list of words with hints in between) and then from that choice, a file will be opened and a secret word will be displayed (with ? for every letter) and then a hint.
The file is arranged like this
word01
hint
word02
hint
I have to display the word masked, and then the hint is displayed automatically.
So the ??? words are prime numbers and the hints are even.
There are 46 lines
I need help really badly, it's for my last project to C++, I'd really like to figure it out on my own however I'm running out of time, the semester is almost over.
ok , so word 1 is at line 1, word 2 at line 3, word 3 at line 5 ....
so if we have an index initialized to 0 :
the word i will be at line : 2*(index = i-1)+1
where index keeps growing by 1 each time
word 1 --> 2*(index=0)+1 = 1.
word 2 --> 2*(index=1)+1 = 3.
word 3 --> 2*(index=2)+1 = 5.
and so on.
so after getting input from the user, calculate the correct line in the file, count the number of chars in that word and display a matching set of "?" (maybe keep the actual word in a variable), and the display the next line in the file -- the hint to the user.
hope this helps, i'll be happy to answer more specific questions about your project.