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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
#include <iostream>
using namespace std;
int multi ( int a, int b);
int divide ( int c, int d);
int add ( int e, int f);
int sub ( int g, int h);
int main ()
{
int input;
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;
cout << "Please pick what you wish to do:\n";
cout << "1. Multiply \n";
cout << "2. Divide \n";
cout << "3. Addition \n";
cout << "4. Subtraction \n";
cout << "5. Exit program \n";
cout << "Selection: ";
cin >> input;
switch (input)
{
case 1:
cout << "Please enter two numbers to multiply:";
cin >> a >> b;
cin.ignore();
cout << "The result of your numbers was: "<< multi (a,b)<<"\n";
break;
case 2:
cout << "Please enter 2 numbers you with to divide: \n";
cin >> c >> d;
cin.ignore();
cout << "The result of your two numbers was: "<< divide (c, d)<<" \n";
cin.ignore();
break;
case 3:
cout << "Please enter two numbers you wish to add together: \n";
cin >> e >> f;
cin.ignore();
cout << "The result of your two numbers was: "<< add (e, f)<<" \n";
break;
case 4:
cout << "Please enter two numbers you want to be subtracted: \n";
cin >> g >> h;
cin.ignore();
cout << "The result of your two numbers was: "<< sub (g, h) <<" \n";
break;
case 5:
cout << "Thank you for using this program, good bye!\n";
cin.ignore();
break;
Default :
cout << "Wrong input, program closing.";
cin.ignore();
break;
}
cin.get();
}
int multi ( int a, int b)
{
return a * b;
}
int divide ( int c, int d)
{
return c / d;
}
int add ( int e, int f)
{
return e + f;
}
int sub (int g, int h)
{
return g - h;
}
|