title: How to check if variable is whole in C++ without a math library
body: <p>I'm writing a little program for a beginner C++ class, I'm supposed to take an input (I'm using double, because I like to make things harder for myself) from a user and output whether it's prime or composite, and if it's composite, I need to output at least one number which the number is divisible by.</p>
  
  <p>I have too much time on my hands so I'm going a little out of my way to make it harder. I'm trying to do everything without using anything but iostream. I've gotten most of it, but this bit is stumping me: How can I determine if a double is an integer without using a math library?(I found questions that had good solutions using math.h here, but nothing without it) I'd like to think there's a way to do it without writing fifty lines of code for something that seems so simple ...</p>