title: Word guessing game in C
body: <p>I am having some issues writing a program. The program is essentially the word guessing game hangman. I have the store a word, and the user gets however many chances to guess the word. I'm having trouble getting the game to loop correctly and end when the number of guesses has been used up. Also, I made a second array with, the same size as the array with my word, but this array is filled with dashes. If a letter is correctly guessed, I need the correct letter to show up around the dashes. If somebody can help, I would really appreciate it. </p>
  
  <pre><code>#include &lt;stdio.h&gt;   // Input and output operations
  #include &lt;stdlib.h&gt;  // General purpose functions
  
  int main(void)
  {
     FILE*fp;          // File pointer variable
     fp = fopen("Quiz 6", "w");
  
     int numTries, tries, i;  // Declaration of variables
     char guess;
     char myWord [6] = {'a','p','p','l','e','\0'};  // Initialization of variables
     char dashedArray [6] = {'-','-','-','-','-','-'};
  
     numTries = 0;
     i=0;
     tries = 0;
  
     printf("\nLet's play a game! The objective of the game is to guess my secret word. You will have
            five chances to guess.\n");
     printf("\nLet's get started!\n");
     printf("\nPlease enter a letter: ");
     scanf("%c", &amp;guess);
  
     for (i = 0; i &lt; 4; i++)
     {
        numTries = numTries +1;
        if (guess == myWord [0])
        {
           printf("\n %c----", myWord [0]);
           printf("\nGood Guess!\n");
           printf("\nPlease guess another letter: ");
           scanf(" %c", &amp;guess);
        }
  
        if ( guess == myWord [1] &amp;&amp; myWord [1] )
        {
           printf("\n-%c%c--", myWord [1], myWord [1]);
           printf("\nGood Guess!\n");
           printf("\nPlease guess another letter: ");
           scanf(" %c", &amp;guess);
        }
  
        if ( guess == myWord [3] )
        {
           printf("\n---%c-", myWord [3]);
           printf("\nGood Guess!\n");
           printf("\nPlease guess another letter: ");
           scanf(" %c", &amp;guess);
        }
  
        if ( guess == myWord [4] )
        {
           printf("\n----%c", myWord [4]);
           printf("\nGood Guess!\n");
           printf("\nPlease guess another letter: ");
           scanf(" %c", &amp;guess);
        }
  
        if ( if word is completed and guessed correctly )
        {
           printf("\nCongrats! You guessed the secret word!\n");
        }
  
        else if ( guess != myWord )
        {
           printf("\nSorry. That is not a correct letter. Please guess again:\n");
           scanf(" %c", &amp;guess);
        }
     }
  }
  </code></pre>