As the previous solution by Pablo has correctly shown, the problem lies in the line
int cents = (amount - dollars) * 100;
and you were correct in your comment. What happens is that (amount - dollars) is a floating point operation (contrary what one of the comments above said) and delivers a value of 0.849998 or something the like. This is due to the fact that the floating point representation cannot correctly store all rational numbers. Instead it uses the nearest approximation that can be represented by a mantissa to the base 2.
In the next step that value is multiplied by 100 (which is also forced up to floating point) and you get: 84.9998, which is then truncated to 84 by the cast to int.
So what went wrong? You should not have cast the value to int but
rounded it to int. Here is a way to do that:
double centsDlb = (amount - dollars) * 100.0;
int cents = floor (centsDlb + 0.5);
Of course you can contract both lines of code to a single one.
The solution given by Pablo will also get you there, but imagine what happens if someone specifies 79.849 as input. That's why you want to use rounding.
Don't forget to include "math.h" when you use the floor function.
And you might want to check what happens if someone enters a negative amount to your function.
Hope that helps.