title: While loop doesn't terminate?
body: <p>I was wondering why this while loop doesn't allow my program to terminate? </p>
  
  <p>As I understand (though I could well be wrong) the condition <code>while (cin &gt;&gt; line)</code> checks my input stream for a String and then runs my loop until there is no other String found in the input. However after testing my code I get the correct output but my loop never terminates any idea as to why?</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;cctype&gt;
  
  using namespace std;
  
  int main() {
  
  string roman_digits[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};
  string roman_tens  [] = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"};
  string roman_hundreds [] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
  string roman_thousands [] = {"", "M","MM", "MMM"};
  string line;
  char c;
  
  
  cout &lt;&lt; "Type in a Roman numeral: ";
  
  // Loops through inputted Roman Numerals.    
  while (cin &gt;&gt; line){
      int i = 0;
  
      // Loops through a Roman numeral and changes it to uppercase.
      while(line[i]){
          c = line[i];
          c = (toupper(c));
          line[i] = c;
          i++;
      }
  
  
  // Loops through checking roman numeral with the thousands array and if there is a match prints out the equivalent arabic number.
      for (int i = 0; i &lt; 10; i++){
         if (roman_thousands[i] == line){
             cout &lt;&lt; "The Arabic equivalent of " 
                  &lt;&lt; line &lt;&lt;" is: " &lt;&lt; i &lt;&lt; 0 &lt;&lt; 0 &lt;&lt; 0 &lt;&lt; endl;
          }
      }
   // Loops through checking roman numeral with the hundreds array and if there is a match prints out the equivalent arabic number.
      for (int i = 0; i &lt; 10; i++){
          if (roman_hundreds[i] == line){
              cout &lt;&lt; "The Arabic equivalent of " &lt;&lt; line &lt;&lt; " is: " &lt;&lt; i &lt;&lt; 0 &lt;&lt; 0 &lt;&lt; endl;
          }
      }
       // Loops through checking roman numeral with the tens array and if there is a match prints out the equivalent arabic number.
      for (int i = 0; i &lt; 10; i++){
          if (roman_tens[i] == line){
              cout &lt;&lt; "The Arabic equivalent of " &lt;&lt; line &lt;&lt; " is: " &lt;&lt; i &lt;&lt; 0 &lt;&lt; endl;
          }
      }
       // Loops through checking roman numeral with the digits array and if there is a match prints out the equivalent arabic number.
      for (int i = 0; i &lt; 10; i++){
          if (roman_digits[i] == line){
              cout &lt;&lt; "The Arabic equivalent of " &lt;&lt; line &lt;&lt; " is: " &lt;&lt; i &lt;&lt; endl;
          }
  
      }
   }
  
  
    return 0;
  
  
  }
  </code></pre>