HDOJ--1000A + B Problem

原题链接

Problem Description
Calculate  A + B.
 

Input
Each line will contain two integers  A and  B. Process to end of file.
 

Output
For each case, output  A + B in one line.
 

Sample Input
 
  
1 1
 

Sample Output
 
  
2
 
题目很简单,计算A+B,在ACM中大部分题目采用文件输入的形式,需要使用while( XXX!=EOF)的形式

代码:
#include<stdio.h>
 
 int main()
 {
 	int a,b;
 	while(scanf("%d%d",&a,&b)!=EOF)
 	{
 		printf("%d\n",a+b);
	 }
 	return 0;
 }



猜你喜欢

转载自blog.csdn.net/y_cnew/article/details/79828276