其他分享
首页 > 其他分享> > 杭电oj:A + B Problem

杭电oj:A + B Problem

作者:互联网

Problem - 1000 (hdu.edu.cn) 

 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