0

I tried changing from float to int, but is still the same no matter if i input a integer or a float the program still seems like it doesn't receive anything. i think my problem might be on the while loop or on the round. PD: Sorry for my bad english. enter image description here

    ...

    do
    {
    printf("Please enter the mount of money owed in USD:");
    n = GetFloat();
    c = round(n*100);
    }
    while (n>=0);

    ...

    [Edit: code irrelevant to problem removed per Honor Code compliance.]
0

Some errors are easily overlooked even when you look right at them.

while (n>=0);

Recall that the loop will repeat whenever the test condition is true. You want the loop to repeat whenever you don't have a non-negative number, in other words, you do have a negative. If the user input is a positive number or 0, you want the loop to stop. Time to make a change to the test clause in the while loop.

If this answers your question, please click on the check to accept. Let's keep up on forum housekeeping. ;-)

1
  • Cliff B Thank you so much dude! I can't believe my error was only that little thing hahahaha... I spend many hour modifying my code and getting nothing xD
    – user9689
    Sep 23 '15 at 20:50

You must log in to answer this question.

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