I need to check if a variable is a whole number, say I have the code:
double foobar = 3; //Pseudocode if (foobar == whole) cout << \"It\'s whole\";
just write a function or expression to Check for whole number, returning bool.
function
expression
whole number
bool
in usual definition i think whole number is greater than 0 with no decimal part.
then,
if (abs(floor(foobar) )== foobar) cout << "It's whole"; else cout << "Not whole";