I am able to ask the user for change and then round and convert to an int enter image description here I know this works because i compiled it alone and it produced values without decimal.

I then though I just need to create while loops with the new int total and run it for quarters, dimes... But nothing happens. When I run it, it asks user for change and that's it! This is the code that I used, which I repeated for each of the coins: enter image description here

Note: I did not define the coins =0 at beginning (e.g. quarters = 0) - And when I tried this, it didn't work either...

  • You have described an infinite loop, but it is impossible to tell where it is because you haven't included enough of your code. For example, you start a do/while loop on line 21 but the end of the loop is not shown. Meanwhile, you have a complete while loop on lines 23 through 28. Also, please explore the help tab at the top of this page, specifically the parts on how to post formatted code correctly. After doing so, please edit your question and post all of the relevant code instead of screen capture images. It'll make it easier for everyone to help you.
    – Cliff B
    Nov 21 '15 at 3:28
  • Why is the while loop at 23 inside the do-while at 21? Nesting isn't needed there imo.
    – sinister
    Nov 21 '15 at 3:45
  • I think I got it... needed a closing curly bracket. Nov 21 '15 at 3:51

You must log in to answer this question.

Browse other questions tagged .