#include <iostream>
using namespace std;
int a(int num1, int num2)
{
int sum = num1 + num2;
cout << "运算完成!结果为" << sum << endl;
return sum;
}
int b(int num1, int num2)
{
int sum = num1 - num2;
cout << "运算完成!结果为" << sum << endl;
return sum;
}
int c(int num1, int num2)
{
int sum = num1 * num2;
cout << "运算完成!结果为" << sum << endl;
return sum;
}
int d(int num1, int num2)
{
int sum = num1 / num2;
cout << "运算完成!结果为" << sum << endl;
return sum;
}
int main()
{
int num1;
int num2;
start:
cout << "请输入第一个数" << endl;
cin >> num1;
cout << "请输入第二个数" << endl;
cin >> num2;
cout << "你要进行什么运算?(1为加法、2为减法、3为乘法、4为除法)" << endl;
int y = 0;
cin >> y;
if(y == 1)
{
int sum = a(num1, num2);
}
if(y == 2)
{
int sum = b(num1, num2);
}
if(y == 3)
{
int sum = c(num1, num2);
}
if(y == 4)
{
int sum = d(num1, num2);
}
system("pause");
return 0;
}