Validating Monetary Input
the user needs to enter a monetary value only into the program with with no extraneous cents, for example, 56, 56.32 178654.44, but not 123.223 etc.
I'm reading the data input via the keyboard into a string and using the atof function to convert the string to a double. The problem i am stuck at is I have to know check the number to make sure it contains no more than 2 deciamal places. I was on the path to multiplying the number by 100 to convert it to only "cents", but i don't know how to check to see if there are any extranous values after the new decimal points.
Say the input was 134.578
multiplying by 100 would give 13457.8 the problem now is how can I (efficiently) check to see that there is a 8 after the . ?