Hey I seem to be gotten stuck on a simple C problem. The program is supposed to ask user for a number, till EOF and then print out the highest, lowest and average statistic.
I have something like this in the code:
Buf is a char, and all this is inside a loop:
Then i just print out the average(sum/count) and max and min.Code:do { input=atof(gets(buf)); max=min=sum=input; count++; if (input <= min){ input=min;} if (input >= max){ input=max;} sum = sum + input; } while (strlen(buf) > 0);
So if anybody can point me to a valid (but simple) solution that would be appreciated.
Thanks..
R.



LinkBack URL
About LinkBacks


