Skip to main content
added 142 characters in body
Source Link
Yuri Laguardia
  • 2.6k
  • 1
  • 10
  • 17

You're using cent_amount again and again, without updating. I think you meant to use something else instead at those places I've marked below:

quarter_amount= cent_amount / QUARTER;
leftover_amount= cent_amount % QUARTER;

dime_amount= leftover_amount/ DIME;
leftover_amount= cent_amount % DIME;

nickel_amount= leftover_amount/ NICKEL;
leftover_amount= cent_amount % NICKEL;

EDIT: Then you'll also have a problem with float imprecision, which will need the round() function. But let's leave that for another question.

You're using cent_amount again and again, without updating. I think you meant to use something else instead at those places I've marked below:

quarter_amount= cent_amount / QUARTER;
leftover_amount= cent_amount % QUARTER;

dime_amount= leftover_amount/ DIME;
leftover_amount= cent_amount % DIME;

nickel_amount= leftover_amount/ NICKEL;
leftover_amount= cent_amount % NICKEL;

You're using cent_amount again and again, without updating. I think you meant to use something else instead at those places I've marked below:

quarter_amount= cent_amount / QUARTER;
leftover_amount= cent_amount % QUARTER;

dime_amount= leftover_amount/ DIME;
leftover_amount= cent_amount % DIME;

nickel_amount= leftover_amount/ NICKEL;
leftover_amount= cent_amount % NICKEL;

EDIT: Then you'll also have a problem with float imprecision, which will need the round() function. But let's leave that for another question.

Post Undeleted by Yuri Laguardia
answer to the wrong topic before
Source Link
Yuri Laguardia
  • 2.6k
  • 1
  • 10
  • 17

Tell me if my answer to this guy's question also answers your question. If notYou're using cent_amount again and again, I'll elaboratewithout updating. I think you meant to use something else instead at those places I've marked below: enter image description here

quarter_amount= cent_amount / QUARTER;
leftover_amount= cent_amount % QUARTER;

dime_amount= leftover_amount/ DIME;
leftover_amount= cent_amount % DIME;

nickel_amount= leftover_amount/ NICKEL;
leftover_amount= cent_amount % NICKEL;

Tell me if my answer to this guy's question also answers your question. If not, I'll elaborate: enter image description here

You're using cent_amount again and again, without updating. I think you meant to use something else instead at those places I've marked below:

quarter_amount= cent_amount / QUARTER;
leftover_amount= cent_amount % QUARTER;

dime_amount= leftover_amount/ DIME;
leftover_amount= cent_amount % DIME;

nickel_amount= leftover_amount/ NICKEL;
leftover_amount= cent_amount % NICKEL;

Post Deleted by Yuri Laguardia
Post Undeleted by Yuri Laguardia
Post Deleted by Yuri Laguardia
Source Link
Yuri Laguardia
  • 2.6k
  • 1
  • 10
  • 17

Tell me if my answer to this guy's question also answers your question. If not, I'll elaborate: enter image description here