Two approaches:Originally Posted by zach
- Remove the '.' from the string then convert it to an integer. Now you deal with integers that are 100 times the actual value, so when you want to print, you just do n / 100 to get the part before the decimal point and n % 100 to get the part after the decimal point. Of course, you have to keep in mind the max value for the integer type.
- Use a fixed point arithmetic library or write your own.