qfedu-basic-level/day9/homework/h1.cpp

18 lines
326 B
C++

// 编写一个函数,用于计算两个整数的和,并返回结果。
#include <iostream>
using namespace std;
int sum(int a, int b)
{
return a + b;
}
int main()
{
int a, b;
cout << "请输入两个整数:";
cin >> a >> b;
cout << "两个整数的和为:" << sum(a, b) << endl;
return 0;
}