you are not asked to deal with overlfow --- instead the main prolbem is to handle the '\n' in the input stream.
I am working on a system which has no Chinese input. Please don\'t blame me for typing English.
我这里用了两个代码 一个是后来做出来的 一个是改进的 (虽然改进的不在是死循环 但是因为在有些编译器里要输入两个ctrl+z才能退出 所以通不过)
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
char input[100],*p;
int i=0;
while(gets(input)){
i=0;i+=atoi(strtok(input," "));
while(p=strtok(NULL," "))
i+=atoi(p);
printf("%d\n",i);
}
}
[此贴子已经被作者于2007-7-22 16:47:08编辑过]