关于循环控制,请教高手!
#include<stdio.h>#include<stdlib.h>
int main(void)
{
long num;
long sum = 0L;
int status;
printf("Please enter an integer to be summed.");
printf("(q to quit):");
status = scanf("%ld",&num);
while(status == 1)
{
sum = sum + num;
printf("Please enter next integer (q to quit):");
status = scanf("%ld", &num);
}
printf("Those integers sum to %ld.\n",sum);
system("pause");
return 0;
}
很奇怪 status的值怎么会是否==1
请教高手,谢谢。