题解 | #两数求和#
两数求和
https://www.nowcoder.com/practice/f1b704af4f654be285552bea53ce6534
#include <iostream>
using namespace std;
int main() {
// write your code here......
int a, b, iNum;
cin >> a;
// 按照题目要求定义数字类型的区间
if(a > 1000 || a < -1000)
{
cout << "输入错误" << endl;
return 0;
}
cin >> b;
if(b > 1000 || b < -1000)
{
cout << "输入错误" << endl;
return 0;
}
iNum = a + b;
cout << iNum << endl;
return 0;
}

查看19道真题和解析