title: Write a C++ program that reads integers from standard input until end of file
body: <blockquote>
    <p>Write a C++ program that reads integers from standard input until end of file.<br>
    Print out the largest integer that you read in, on a line by itself.
    <br>Any erroneous input (something that is not an integer) should be detected and ignored.
    <br>In the case where no integers are provided at all, print NO INTEGERS and stop.
    <br>The whole program is under 40 lines of code. Just read from cin.</p>
  </blockquote>
  
  <pre><code>#include&lt;iostream&gt;
  
  using namespace std;
  
  int main(){
  
      int number;
      int LargerNumber;
      int n = 0;
  
      cin &gt;&gt; number;
  
      while(!cin.eof()){
          if(n==0)
              LargerNumber = number;
  
          if(LargerNumber &lt; number)
              LargerNumber = number;
  
          n++;
          cin &gt;&gt; number;
      }
  
      if(n==0)
          cout&lt;&lt;"NO INTEGERS"&lt;&lt;endl;
      else
          cout&lt;&lt;"Largest: "&lt;&lt; LargerNumber &lt;&lt;endl;
  
      return 0;
  }
  </code></pre>
  
  <p>So, this program does compile, but when I build it and run it in the program our teacher told us to use, it does not output the correct statement.</p>
  
  <p>The teacher will input some numbers, and we had to output the biggest integer, but we have to output an error it either there is no integer or output an error if there is character/words in there.</p>
  
  <p>Ex: If the input is this  7 4 19 99 8 309256, the output should be 309256, but my program keeps timing out, or just outputs the first number, 7,</p>
  
  <p>Ex:  Input 2,44,66,83,4,5,-9
  output: error negative number</p>
  
  <p>Ex: Input 4,7,-8,22,3,5
  output: error negative number</p>
  
  <p>Ex: Input 3,6,8,ad,4,6
  output: error ad, not an integer</p>
  
  <p>Ex: Input 55,7,81,2,4,5,9.9,0
  output: error 9.9 is not whole integer</p>