I would suggest you to go through Hangman game source code as well.