I have a loop that gains a number from the user and stores it in an array. So far, if you enter a character, it denies the character, sets the count back one number, and asks again, rewriting the previous failed attempt. When I attempt to enter a float, it accepts the first number into the array, and then attempts to read the decimal part, which it declines and says that it's not an integer. I want it to be able to realize that the entire number is a float and reject all aspects of it including the integer out front, asking the user for an entirely new input.
I want it to be able to realize that the entire number is a float and reject all aspects of it including the integer out front, asking the user for an entirely new input.
I am afraid there is only one way: get input as a string, make sure that all characters are digits and if so, parse number as string: