Posted: Tue Sep 22, 2009 2:16 pm Post subject: RE:Whole Number Finding?
There's also a simple error check that you can do.
Turing:
var num :string get num
ifstrintok(num)then put"Whole number." else put"Real number/Complex Number/Word" endif
andrew.
Posted: Tue Sep 22, 2009 4:18 pm Post subject: RE:Whole Number Finding?
You can do this multiple ways. One way is to round it and see if it is different. If it is, then it wasn't an integer. Another way is to do what Kharybdis said and convert the number to a string (or get it as a string) and then see if it's okay for it to be an integer (strintok). If it is, then it is an integer, otherwise it's something else.