C++洛谷P1001 A+B Problem
题目
链接:https://www.luogu.com.cn/problem/P1001
解析
模板代码
#include <iostream>
using namespace std;
int main() {return 0;
}
创建变量
int a, b; // int : 类型(整数) a, b : 两个变量 ; 语句结束
从终端获取变量
用cin获取,格式cin >> 变量1 >> 变量2 >> ...
cin >> a >> b;
输出
输出a+b,用P1000学的cout。
cout << a + b << endl;
代码
#include <iostream>
using namespace std;
int main() {int a, b;cin >> a >> b;cout << a + b << endl;return 0;
}