So it's supposed to scan xx.xx euro and if the money is less than the person has to pay, it prints a message asking them to pay <the remaining> more. The code is:
Code:
handed_in = 0;
remaining = pay;
while (handed_in < pay) {
scanf("%lf", &handed_in);
remaining = remaining - handed_in;
if (remaining > 0) {
printf("PAY %5.2lf more \n", remaining);
}
}
After this, I'm covering the case according to which the person has paid more money than owed, in which case the change is provided.
THE PROBLEM IS: if I pay less the first time, and when asked to pay more, I pay MORE than asked, the program stops scanning and nothing happens. But if I do pay more the first time, things work OK.
So how do I go about this? Replying would mean the world to me.
example:
It says PAY 8.40.
I enter 3.
It says PAY 5.40 more.
I enter 3.
It says PAY 2.40 more.
I enter 3.
And nothing happens next. :/