0

I will start talking about mario, because i can't see anything incorrect with it. So, here we go: This is my codeline:

enter image description here

and here is some inputs/outputs (i believe it is working correctly): enter image description here

However, when i test it,the line "handles a height of" 1,2 and 23 can't pass the test. What am i missing?

Now, let's talk about my "greedy" program, i believe that i wrote a correct code, and it worked for every value i tested... with the exception of 4.2. All values around it (3.2, 4.15, 4.25, 4.30,5.2) worked correctly, but the 4.2 prints out 22 instead of 18. Also, the program won't pass in NONE of the "numeric" checks. Here is my codeline for greedy:enter image description here

I tried a lot looking at these codes to see if i could find something. But nothing. I need help. Thanks guys!

  • So, i used printf in greedy to see which coins the program was taking, and i got and interessing result: If i give an input of 5.2, for example, it will take 20 coins of 25¢, and two coins of 10¢ (which is correct). If i give an input of 3.2, it will take 12 coins of 25¢ and 2 coins of 10¢ (which is also correct). However, if i give an input of 4.2, it will take 16 coins of 25¢, then 1 coin of 10¢, then 1 coin of 5¢ and 5 coins of 1¢. Why does that happend especifically for 4.2? Any tips? Thanks! – Codeguy78 Oct 30 '16 at 15:19
  • Please delete this question and ask two separate questions. A question should deal with one specific problem. – Cliff B Oct 30 '16 at 20:57
  • Also, instead of screen images of code, please cut and paste the actual code so that it can be copied for testing. Nobody wants to transcribe code from an image to an IDE for testing,. – Cliff B Oct 31 '16 at 2:27

You must log in to answer this question.

Browse other questions tagged .