厦理OJ——1002:A+B Problem

一、题目

Description

Calculate a+b

Input

Two integer a,b (0<=a,b<=10)

Output

Output a+b

Sample Input

1 2

Sample Output

3

Hint

Here is a sample solution for problem using C/GCC: 
#include 
int main() 

int a,b; 
scanf("%d %d",&a, &b); 
printf("%d\n",a+b); 
return 0; 
}

二、解析

emmm这题让你copy好了(官方让你copy我也没办法QAQ),下面就直接给出C++源码

三、源码

#include <iostream>
//C语言使用<stdio.h>
using namespace std;

int main()
{
	int a, b;
	//数据输入
	cin >> a >> b;
	//输出
	cout << a + b;

	return 0;
}

四、深入研究

大家应该感觉这题没任何难度吧(废话 复制粘贴的事!),但是实际中我们可能会遇到更大数字的四则运算,使用int型可能无法满足,有人会说上double啊,来,你来存个PI,存进去算我输(滑稽),所以可能就要换一种计算的思路,大家可以思考思考,先从加法做起

posted @ 2018-11-06 23:10  SpacePioneer  阅读(33)  评论(0)    收藏  举报