title: Is there a way to check if a variable is a whole number? C++
body: <p>I need to check if a variable is a whole number, say I have the code:</p>
  
  <pre><code>double foobar = 3;
  //Pseudocode
  if (foobar == whole)
      cout &lt;&lt; "It's whole";
  else
      cout &lt;&lt; "Not whole";
  </code></pre>
  
  <p>How would I do this?</p>