#include <iostream>
using namespace std;
int jia(int a = 0, int b = 0);
int jian(int a = 0, int b = 0);
int cheng(int a = 0, int b = 0);
int chu(int a = 0, int b = 0);
int main()
{
int num1 = 0;
int num2 = 0;
std::cin >> num1;
std::cin >> num2;
std::cout << num1 << " + " << num2 << " = " << jia(num1, num2) << std::endl;
std::cout << num1 << " - " << num2 << " = " << jian(num1, num2) << std::endl;
std::cout << num1 << " * " << num2 << " = " << cheng(num1, num2) << std::endl;
std::cout << num1 << " / " << num2 << " = " << chu(num1, num2) << " (四舍五入) " << std::endl;
return 0;
}
int jia(int a, int b)
{
return a + b;
}
int jian(int a, int b)
{
return a - b;
}
int cheng(int a, int b)
{
return a * b;
}
int chu(int a, int b)
{
double c, d, e;
c = a;
d = b;
e = (c / d) - (a / b);
return e < 0.5 ? (a / b) : (a / b) + 1;
}
新手入门,如果代码有什么问题或者可以改进的地方希望大家指导一二,谢谢啦~