Instead of using only a locally-scoped letter, why not have an array of letters in your global scope? For example...

//Somewhere under the header, near the namespace declaration...
char[27] guessedChars = {0};

Now you'll have a fully null-terminated char array capable of holding 26 characters from index 0-26. I say 26 instead of 27 because the last should be reserved for a final null terminator.

What you'll want to do now is use a temporary char as the "receiver" for user input then iterate through your char array until you reach null. If you don't find a matching character in your char array before reaching null, place a copy of the char entered in the guessedChars array. If the value already exists you should warn the user and tell them that they've already guessed that character (or simply just penalize them hangman style).

you are creating a brand new variable named guessword for every correct guess. So guessword is an empty string when it is created. You are passing this empty string to the revealword function. guessword is is NOT passed by reference to revealword, so it remains empty after you return from revealword. You are then passing an empty string to the function DisplayAWord. I am guessing that you want to create guessword OUTSIDE of the else block and/or pass it to revealword by reference (is guessword supposed to be changed in revealword?).

Say we have the word "vista" - vista gets stringed in through fileword as "_ _ _ _ _" - same number of letters to dashes, also letter is in to see if it is in fileword, if it is then guessword will cout which eve position the letter guessed is in. "V _ _ _ _". Atleast thats how its suppose to work.

Say we have the word "vista" - vista gets stringed in through fileword as "_ _ _ _ _" - same number of letters to dashes, also letter is in to see if it is in fileword, if it is then guessword will cout which eve position the letter guessed is in. "V _ _ _ _". Atleast thats how its suppose to work.

O.K. but what if they then guess 't'? Should guessword, before the call to revealword, be this:

Correct, if they guess "v" the first time the output should be v _ _ _ _
Then if they guess "t" the second time the ouput should be v _ _ t _
Then the third guess "i" then the output should be vi _ t _
until they get the word all the way.

Right now if a user inputs "v" the first time, then the output is v _ _ _ _
then the second time they input "t" the output is _ _ _ t _
and it needs to be v _ _ t _
it needs to keep the letters

Your problem is in lines 12 through 19. You are initializing secret to all underscores in lines 12 - 16, then assigning those underscores to guessword in line 19. Anything that used to be in guessword before has been wiped out here. Thus the 'v' that was in guessword before is now an underscore. This is the same problem you had before when you had created guessword in the else statement before you deleted that line. You are initializing it every time you get a correct letter the way you have it. You need to initialize it ONCE. After you have picked fileword, but before you start guessing, you want to initialize guessword to all underscores. Then delete lines 3 - 19. You don't need them. While you are at it, you don't need any of those if-else if statements since you do the exact same thing regardless of the value of position. Also, you are hardcoding 0 through 5 here. How do you know the word will be exactly six letters long? Ditto with line 35. It can be replaced simply with this:

cout << guessword << endl;

So initialize guessword to all underscores in the MAIN function after you assign a word to fileword in main(). Take that code out of the revealword function. You'll have to change that code slightly when you put it in main() in order to initialize guessword correctly.

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...