我需要接收数字,直到按回车键,我试图将 scanf 的返回值与 EOF 进行比较,但它一直要求我输入更多数字(无限循环):
int fail=0, late=0, avg=0, i=0, last=0, current, permission, difference;
while(scanf(" %d", ¤t) != EOF)
{
permission = (current < last);
difference = ((last - current) >= 30);
fail += difference*permission;
late += permission;
avg += (last - current)*(permission);
last = last*(permission) + current*(!permission);
}
有什么建议么。
谢谢