1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include <iostream>
using namespace std;
void add(float first_num, float second_num, float answer);
void minus(float first_num, float second_num, float answer);
void times(float first_num, float second_num, float answer);
void divide(float first_num, float second_num, float answer);
int main()
{
float first_num;
float second_num;
int x;
float answer;
cout << "please enter first number";
cin >> first_num;
cout << "please enter second number";
cin >> second_num;
cout << " please enter 1, 2, 3 or 4 for the mathematical operator + - * or / correspondinly";
cin >> x;
switch (x)
{
case '1':
add(first_num, second_num, answer);
break;
case '2':
minus(first_num, second_num, answer);
break;
case '3':
times(first_num, second_num, answer);
break;
case '4':
divide(first_num, second_num, answer);
break;
default:
cout << "number entered incorrectly";
return 0;
}
return 0;
}
void minus(float first_num, float second_num, float answer)
{
first_num - second_num == answer;
cout << answer;
}
...
|