Firstly, for the love of god use the [ CODE] [ /CODE] tags. Its really hard to read code without indentation. You have a guess word and you have a hidden word and you are trying to see if letters of the guess are in the hidden word and if they are count if they are in the right position or not. The code uses nested for loops. For each letter in the hidden word it runs through each letter in the guess word. Within the inner loop it compares the letters to see if they are the same value. If they are the same value it then moves into the final set of if/else conditions and checks if the letters are in the same position in both words by comparing each of the index variables from both of the loops. Note that the index counter in each loop will tell you the position of the current letter being examined. If these are code snippets from a course or book you should really be throwing them into some .cpp files, compiling them and stepping through them with a debugger to see how they work.
Cheers dude, hadn't noticed the code tags before. Its my code I've written along side the tutorials, Its more about getting my head around the process of how its working. The guy doing the videos can tend to go off on a tangent and never actually say what's happening.