美文网首页
[DeepJudge P1000] A+B Problem 题解

[DeepJudge P1000] A+B Problem 题解

作者: DeepJudge官方题解 | 来源:发表于2019-02-10 18:27 被阅读0次

这是一道入门题,很简单。

输入/输出可以用cin/cout,代码如下:

#include <iostream>
using namespace std;
int main(){
    int a, b; //定义两个变量
    cin >> a >> b; //从标准输入流中输入两个整数
    cout << a + b << endl; //输出到标准输出流中
    return 0;
}

输入/输出也可以使用scanf/printf,代码如下:

#include <cstdio>
int main(){
    int a, b; //定义两个变量
    scanf("%d%d", &a, &b); //使用scanf读取两个整数至变量a、b
    printf("%d\n", a + b); //使用printf输出a+b的值
    return 0;
}

相关文章

网友评论

      本文标题:[DeepJudge P1000] A+B Problem 题解

      本文链接:https://www.haomeiwen.com/subject/hysxeqtx.html