一道简单的英文述题的C语言编程题.要求答案思路精确.The first line integer means the number of input integer a and b.Your task is to Calculate a + b.输入Your task is to Calculate a + b.The first line integer means the numbers of
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 09:29:35
一道简单的英文述题的C语言编程题.要求答案思路精确.The first line integer means the number of input integer a and b.Your task is to Calculate a + b.输入Your task is to Calculate a + b.The first line integer means the numbers of
一道简单的英文述题的C语言编程题.要求答案思路精确.
The first line integer means the number of input integer a and b.Your task is to Calculate a + b.
输入
Your task is to Calculate a + b.The first line integer means the numbers of pairs of input integers.
输出
For each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.
样例输入
2
1 5
10 20
样例输出
6
30
一道简单的英文述题的C语言编程题.要求答案思路精确.The first line integer means the number of input integer a and b.Your task is to Calculate a + b.输入Your task is to Calculate a + b.The first line integer means the numbers of
首先要把题目看明白.
第一行的输入是指要输入a和b的对数,从第二行开始,每一行就是一对a,b,你的任务是计算a+b的结果,并在最后输出出来.
我定义1个整形变量n用来保存第一个输入,然后用它动态生成一个数组,用这个数组来保存每一行a+b的值,代码如下:
int main()
{
int n;
cin>>n;
int x,y;
int *p=new int[n];
for(int i=0;i>x>>y;
p[i]=x+y;
}
for(int i=0;i