#include<cstdio>
using namespace std;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int x;
int sum=0;
while (~scanf("%d",&x))sum+=x;
printf("%d\n",sum);
}
追问运行之后没有反应啊,要输入什么吗
追答把一串数字放入input.txt中就行了如
=========input.txt=========
1 2 3
=========output.txt========
6
本回答被网友采纳