title: How to detect an empty int input?
body: <p>I am trying a coding Q and am looking for a line of code that detects if there was no input given (user just presses enter). The concerned datatype is int.</p>
  
  <p>I've read few other Qs about this very problem, but didn't fit in well with my needs. I have tried eof &amp; other such suggestions to no avail...</p>
  
  <p>Here's the code - </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;vector&gt;
  using namespace std;
  int main() {
  int ogv,cgv=0,i,j=0,k;
  int arr [3];
  vector&lt;int&gt; ans;
  while(true) {
      cgv=0;
      cin&gt;&gt;ogv;
      //if("ogv is not a number, just an enter") 
            break;
      arr[0]=floor(ogv/4);
      arr[1]=floor(ogv/3);
      arr[2]=floor(ogv/2);
      for(i=0;i&lt;=2;i++) {
          if (arr[i]&lt;0)
              arr[i]=0;
          cgv+=arr[i];
      }
  
      if(ogv&gt;cgv) {
          ans.push_back(ogv);
      }
      else {
          ans.push_back(cgv);
      }
     j++;
  }
  for(k=0;k&lt;j;k++) {
      cout&lt;&lt;ans.at(k)&lt;&lt;endl;
  }
  }
  </code></pre>
  
  <p>Your help is greatly appreciated...! :D</p>
  
  <p>Thanks</p>