Problem - 1000 (hdu.edu.cn)
![](https://www.icode9.com/i/ll/?i=a6eb3be485cc4182921ee54db346ef1a.png?,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5bGx772e5rW3,size_20,color_FFFFFF,t_70,g_se,x_16)
1、由于scanf()函数返回值为其输入数据的个数,当没有输入的时候将返回-1,所以可以以此来控制输入。
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int a,b;
while(~scanf("%d%d",&a,&b))
printf("%d\n",a+b);
return 0;
}
标签:oj,int,scanf,杭电,Problem,include,输入,cn
来源: https://blog.csdn.net/qq_50917103/article/details/121113777