After debugging, I find myself in a "loop" of sorts. The program is not recognizing the letters in the gameWord enough, to compare to the letters inputed. Could someone please tell me what I've done wrong.
Thanks.

using System;

namespace Hangman
{
    class Program
    {
        const string letters = "abcdefghijklmnopqrstuvwxyz";
        static readonly string[] wordBank = {

            "fishing","computer","tree","technician","location","work","butterfly","toddler","flowers"
                                                };
        static void Main(string[] args)
        {

            string gameWord;
            bool[] boolLetters = new bool[26];
            char[] wordArray;
            string letters = " abcdefghijklmnopqrstuvwxyz";


            // initializing all letters to false
            boolLetters = new bool[26];
            for (int i = 0; i < boolLetters.Length; i++)
            {
                boolLetters[i] = false;
            }


            // set wordArray to gameWord
            wordArray = new char[1] { ' ' };

            //displaying the game layout
            Console.WriteLine("      ~*~*~*~*~*~*~*~*~*~*~*~    ");
            Console.WriteLine("     ~*~Welcome to Hangman!~*~   ");
            Console.WriteLine("      ~*~*~*~*~*~*~*~*~*~*~*~    ");

            //Ask user to Enter Name
            Console.Write("Please enter your name: ");
            string Name = Convert.ToString(Console.ReadLine());

            //display user greeting message
            Console.WriteLine(Name + ", Welcome to Hangman");
            Console.WriteLine("       ~*~*~*~*~*~*~*~*~*~*~*~    ");
            Console.WriteLine("         ~*~*~Hangman!~*~*~    ");
            Console.WriteLine("       ~*~*~*~*~*~*~*~*~*~*~*~   ");
            Console.WriteLine();

            // creates a random number to choose a word from word bank
            Random random = new Random();
            int randomNumber = random.Next(wordBank.Length);

            //selects the word from the wordBank using randomNumber
            gameWord = wordBank[random.Next(wordBank.Length)];

            // wordArray is set to wordArray
            wordArray = new char[gameWord.Length];
            wordArray = gameWord.ToCharArray();

            string displayWord;
            bool fFound;
            int cFound;
            displayWord = "*";
            displayWord = displayWord.PadRight(gameWord.Length, '*');
            cFound = 0;
            while (cFound < gameWord.Length)
            {
                Console.WriteLine("The word is {0}", displayWord);
                bool repeat = false;
                char guess;
                do
                {
                    Console.Write("Please enter a new letter: " );
                    guess = Console.ReadKey().KeyChar;

                    if (letters.IndexOf(guess) != -1)
                    {
                        guess = char.ToUpper(guess);
                        repeat = false;
                    }
                    else
                    {
                        Console.WriteLine("You can only enter letter values, please re-enter choice.");
                        repeat = true;
                    }
                    fFound = false;
                    for (int i = 0; i < gameWord.Length; i++)
                    {
                        if (gameWord[i] == guess)
                        {
                            displayWord = Convert.ToString(guess);
                            fFound = true;
                            cFound++;
                        }
                    }
                    if (fFound)
                        Console.WriteLine("Letter found");
                    else
                        Console.WriteLine("Letter not found");
                } while (repeat);
            }
        }
    }
}

You convert guess to upper-case on line 77, and compare it to the "gameWord" on line 88, which is all lower-case.

There's a few other things with your code that you should fix as well:

  1. You initialize boolArray twice (line 16 and 22).
  2. All elements of an array, in C#, are given their default value (false for bool), so setting each element to false is unnecessary.
  3. There's no need to initialize wordArray on line 30.
  4. Line 50 is unnecessary, as you never use randomNumber.
  5. Line 56 is unnecessary, as ToCharArray() instantiates the array for you.

That's at a quick glance, there may be a few other things. None of them really break your program, but should still be fixed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.