On Saturday, 20 April 2013 at 12:52:30 UTC, Carlos wrote:
First it takes two reads for the first input from the user and second it only calculates tcsleep.

Oh, I see what you mean by this now. You were describing the problem (I thought you were telling us what the program does).

Ok, so this will fix the problem:

    readf(" %d", &minsleep);

and

    readf(" %d", &minsit);

Notice, the space is before the %d instead of after. The space means "eat all of the whitespace before the next input". So, as you can see, it has to "take two reads" because it's waiting for some non-whitespace information. If you kept hitting enter (or inputting spaces), you'd see that it'd keep prompting you.

Reply via email to