Suppose I have an input of 3.50 (string), how do I parse it so that it gets stored as 3 dollars and 50 cents. Dollars and cents are both integers, and atoi is not allowed.
I have this in mind but apparently it doesn't work in C (assuming token is 3.50):
dollars = int(token); /* dollars is 3 */
cents = atoi(token) - dollars; /* atoi is not allowed but I can't think of anything else */
Thanks!