Input Validation for 5-digit PIN number read from integer

Oct 22, 2014 at 12:35am
The problem states that i need to accept any pin number between "00000" and "99999". I need to read the PIN the user enters as an integer. The problem is that if the PIN is read as an integer, the PIN "01111" will be "1111" which is invalid and the pin "00001" would be read as "1" which is also invalid. How would I go about fixing this problem for PIN numbers that start with a "0"? Again I cannot read the PIN as a char array or string.
Oct 22, 2014 at 12:58am
You could make 00000, .00000 and 99999 , .99999.

Take the number into input and multiply it with base ten to -5th power.

input of 1111 becomes .01111

1 becomes .00001
Last edited on Oct 22, 2014 at 1:14am
Oct 22, 2014 at 1:08am
Thank you so much, greatly appreciate your help
Topic archived. No new replies allowed.