Hi I am working on some code for my class that requires me to validate a floating point number. Once the user enters the number I have to check to see if it is valid, and it is only required that I check the first digit. so if -80 was entered it would be invalid, if something non numeric was entered it would be invalid.
I know of a bunch of ways to do this, but I can only use certain things for the assignment, so all 5+ ways I figured out how to do this aren't valid answers. Basically I have to do this with only float/char data types, loops, strings, arrays, cin/cin.peek()(this one is recommended to use by the teacher, though it doesn't seem to work on floats), and cin.get(), and of course cout. That is all I have to work with to get this to work. Any feedback would be appreciated as this has been puzzling me for some time as it seems impossible to isolate the first digit from the float number to check if it is valid.