title: Hangman only gets first letter of secret word
body: <p>I am trying to write a hangman program for an assignment. I've written code I thought would work, yet when testing it with the secret word, "IMPOSSIBLE", it only reads the "I" and nothing else. I tried changing all my strings to character lists but I don't think that was the issue. Does anyone have any advice on what I am doing incorrectly?
  Thanks,
  Keith.
  Here is the code:</p>
  
  <pre><code>/* CSCI 261 Assignment 5: Hang Man Game
   *
   * Author: Keith Danielson
   *
   * A program that runs a simple hang man game
   */
  
  // The include section adds extra definitions from the C++ standard library.
  #include &lt;iostream&gt; // For cin, cout, etc.
  #include &lt;string&gt;
  
  // We will (most of the time) use the standard library namespace in our programs.
  using namespace std;
  
  //Defining the secret word as a constant
  //const string SECRET_WORD = "IMPOSSIBLE";
  
  int main() {
  
      const char SECRET_WORD[10] = {'I','M','P','O','S','S','I','B','L','E'};
      const int SECRET_WORD_LENGTH = 10;
  
      //Defining the number of wrong guesses available, found letters, wrong guesses, and user choice.
      int guesses = 7;
      char foundLetters[SECRET_WORD_LENGTH];
      char wrongGuesses[guesses];
      char userChoice;
  
  
      //Filling foundLetters with underslashes based on the length of the secret word.
      for (int i = 0; i &lt;= SECRET_WORD_LENGTH; i++) {
          foundLetters[i] = '_';
      }
  
      cout &lt;&lt; "Welcome to hangman!" &lt;&lt; endl;
  
      for (int i = 0; i &lt;= 7; i++) {
          if (guesses == 0){
              break;
          }
          cout &lt;&lt; "Take a guess: ";
  
          for (int j = 0; j &lt;= SECRET_WORD_LENGTH; j++) {
              cout &lt;&lt; foundLetters[j] &lt;&lt; " ";
          }
  
          cout &lt;&lt; "\n" &lt;&lt; "Your guess: ";
          cin &gt;&gt; userChoice;
  
          //if the user input is lowercase it'll be made upper case.
          if (islower(userChoice)) {
              userChoice = toupper(userChoice);
          }
  
          for (int j = 0; j &lt;= SECRET_WORD_LENGTH; j++) {
  
              //if (userChoice == foundLetters[j]) {
               //   cout &lt;&lt; "You already guessed" &lt;&lt; userChoice &lt;&lt; "." &lt;&lt; endl;
              //    break;
              //}
              if (userChoice == SECRET_WORD[j]) {
                  cout &lt;&lt; "There's a " &lt;&lt; userChoice &lt;&lt; "!" &lt;&lt; endl;
                  foundLetters[j] = userChoice;
                  break;
              }
              else if (userChoice != SECRET_WORD[j]) {
                  guesses = guesses - 1;
                  cout &lt;&lt; "Sorry. No " &lt;&lt; userChoice &lt;&lt; "'s." &lt;&lt; endl;
                  wrongGuesses[i] = userChoice;
                  if (guesses == 0) {
                      cout &lt;&lt; "You lose! Try again.";
                      break;
                  }
                  else {
                      cout &lt;&lt; "You have " &lt;&lt; guesses &lt;&lt; " remaining." &lt;&lt; endl;
                      break;
                  }
              }
  
          }
  
      }
  
      return 0; // signals the operating system that our program ended OK.
  }
  </code></pre>