title: How do I stop accepting a string at Enter in C++
body: <p>I'm trying to make a program to find the most common characters in a Hangman game. I want the user to enter a list of movie names(separated by Enter) in standard input. The movie names will be of variable length.</p>
  
  <p>However, the program does not stop accepting input till all the characters of the MOVIE_NAME_SIZE are entered. I tried checking for '\0' and '\n'. It doesn't seem to work. What am I doing incorrectly? Also, is there an easier method to do this?</p>
  
  <p>P.S. - I'm sorry if this is question has been asked before. I looked, and it was suggested to use a method called getline(), but that was for the entire string, while I need to access individual characters.</p>
  
  <pre><code>char movieList[MAX_MOVIES][MAX_NAME_SIZE];
  char CapitalAlphabetList[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
  char smallAlphabetList[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  char numberList[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
  int alphabetCount[26] = {0};
  int numberCount[10] = {0};
  int i, j, k;
  
  for(i = 0; i &lt; MAX_MOVIES; i++)
  {
      for(j = 0; j &lt; MAX_NAME_SIZE; j++)
      {
          cin &gt;&gt; movieList[i][j];
  
          if(movieList[i][j] == '\0')
              break;
  
          for(k = 0; k &lt; 26; k++)
              if((movieList[i][j] == smallAlphabetList[k]) || (movieList[i][j] == CapitalAlphabetList[k]))
                  alphabetCount[k]++;
  
          for(k = 0; k &lt; 10; k++)
              if(movieList[i][j] == numberList[k])
                  numberCount[k]++;
  
      }
  }
  </code></pre>