0

So recently I made a code for the CASH project in CS50, but for some reason its giving me wrong values for the total amount of coins when I think the code is correct. I posted my code down below, could you guys look through it and search for errors? For example, when I put in the value (0.41), I get 3 coins, when the correct value is 4, but for other values such as (0.20), I get the correct value of 2. Thanks! Here is a link to a picture of the code: https://gyazo.com/8730583eaecf4b8bc8c396edd48fce04

1
  • The problem in the code is the central point of the assignment and of the related class material - the inaccuracies of floating point storage. My recommendation is to go back, watch the lectures, and review the walkthroughs in detail.
    – Cliff B
    Commented Aug 18, 2018 at 1:19

1 Answer 1

0

Take a look at the walkthrough for this problem. In the video, Zamyla talks about converting units used in the code and rounding them for the program to work as intended.

Good luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .