my greedy program works fine when I start with an integer, I also know how to round a float; but I don't know how to convert the rounded float to an integer?

  • It seems that when you tested your program, you made input in cents, since the preferred input is in dollars, try 100*(input from GetFloat()) – sinister Sep 6 '14 at 2:41
  • I've already done that but the pgm hangs later. – Gene Sep 6 '14 at 17:40

It's actually very easy. Example:

float x = 1.0; int y = x;

The y becomes the "int" version of "float x", if that makes sense?

  • It partially worked, I had trouble figuring out where to put it, I ended up with "float c = cc; int co = c;" which did produce the value I wanted, BUT for some reason the program won't complete unless the last digit is a zero; in other words 6670 gets me a number of coins, 6678 gets me 6678. and the pgm stops. ctrl c gets control back. got any ideas why the pgm would hang? – Gene Sep 6 '14 at 17:35
  • I found the problem, I had an = where I should have had a - when calculating the number of 1's. – Gene Sep 6 '14 at 19:14

You must log in to answer this question.

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