I'm currently working on Greedy from problem set 1. When I run the CS50 check, everything works correctly except when with an input of 4.2. I know that this is related to how the float isn't rounded correctly. I've searched thoroughly for how to round it correctly but after several hours of reading others' suggestions, I'm still not receiving the correct value for 4.2. How can I round for my specific case? Here's what I have so far:
float amount;
do
{
printf("How much change is owed? ");
amount = GetFloat();
}
while (amount < 0);
int change = amount * 100;