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