Hello, I'm given an assignment where I need to implement a compiler for a language called Simple. for instance given an expression "y = x * 1" I need to output
lvalue y
rvalue x
push 1
*
=
so I need to know if there's an integer involved so I have write it as "push int". That's why I need to know if there's something I can represent as a double or int, so I can treat them differently.
There are a bunch of functions lying around that you can use for this, isdigit being the most obvious. Alternately, you could just try converting it to a double or something straight off and test to see if the task succeeded. For example: