Posted: Sat May 30, 2009 1:19 pm Post subject: Error proofing user input
My program asks for a user to input integer values. Is there a way, just in case a user inputs a real number with decimal places, to make the program check if it is a real number or an integer value?
The numbers MUST be integer values otherwise it will mess up the program.
Sponsor Sponsor
DtY
Posted: Sat May 30, 2009 1:38 pm Post subject: RE:Error proofing user input
the function strintok(String):Boolean will tell you if it can be converted to an integer.
Dusk Eagle
Posted: Sat May 30, 2009 3:47 pm Post subject: Re: Error proofing user input
So, as DtY implied, you should get the input as a string and then use strintok (input), strint (input), strrealok (input), and strreal (input) to convert the variable to the appropriate type.
DtY
Posted: Sat May 30, 2009 3:52 pm Post subject: Re: Error proofing user input
Dusk Eagle @ Sat May 30, 2009 3:47 pm wrote:
So, as DtY implied, you should get the input as a string and then use strintok (input), strint (input), strrealok (input), and strreal (input) to convert the variable to the appropriate type.
Oh yah, I should have mentioned you need to get input as a string. Thanks