For pset1 "Greedy", i believe I have successfully solved it. However, I get errors. I can't seem to find out the problem in my code either, which makes it even more frustrating.
For the first part of my code, I create float values of 'q', meaning quarter, 'd' meaning dime, etc. Then I get the user's input value and store it in a float. Next is where I get my error:
if (c < q)
{
return 0;
} else {
do
{
c = c - q;
count++;
} while (c >= q);
}
What I want my code to do is to see if the user's input (c) is less than a quarter (q). If it is, stop the program, but if it isn't, subtract 1 quarter from the amount of change (c) and update the amount of coins used (count). I also tell my program to keep doing this until the amount change is less than a quarter. I want to repeat this code for dimes, nickels, and pennies, but I still get errors. How can I fix this?