Hey guys!, i'm new to the forum, so Hi!, i suppose is the first appropriate thing i should do, looking forward to getting back into programming and re-developing my (basic) skills!
but to get the point, i have a very basic task in C++ that needs to be complete ASAP, i have basic experience in programming with syntaxes such as Java, VisualBasic; and have a good fundamental understanding of how programming works and practices used.
However, this was over the last 2 years and i have come back fresh to C++!
Anyway, my basic problem is that i have to create a basic 'game' from the command line.
Basically, i have a character array that stores the individual characters that form a word within it's index, in this case the word is 'THEREMIN', users have to guess the individual letters of the word (as it is not displayed to them), and when a character is correctly guessed, it is displayed on the command line, if incorrect a message is displayed informing them of a wrong guess, and takes away a value of 1 from there 'permitted guesses' (being 5).
Essentially, im looking for some direction/advice for the correct combination if/else statements or loops that will enable me to take the user input from the cin command and check it against each character value within the arrays index, and take the appropriate action depending on the conditions met?
Any advice asap would be EXTREMELY appreciated, any other information that i may have admitted, just ask!
You'll need to write/post some code yourself and ask about specific problems you are having if you want the best help.
You'll want a loop to read input so long as the user has guesses remaining and hasn't guessed all the letters in the word. Then read in the input, and display/subtract guesses, etc. based on that.
Use two character arrays - one holds the word, one holds the guessed part of the word.
So you can have word[] with "THEREMIN" and say, guess[] with "T E E " after the player has successfully guessed T and E.
You need to have a variable that holds the number of remaining guesses and a variable that holds the number of remaining unguessed letters. You have a loop with the terminating conditions Zhuge suggested. For each guess from the user you have to search in word[] and update guess[].