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
|
#include <iostream>
#include <cstdlib>
using namespace std;
int main ()
{
int a, b, answer, choice;
cout << " Please enter the number that corresponds to the operation you would like to perform... \n\n";
cout << " 1 - Addition\n";
cout << " 2 - Subtraction\n";
cout << " 3 - Division\n";
cout << " 4 - Multiplication\n\n\n";
cin >> choice;
{
if (choice == 1)
{
cout << "\nGreat, please enter a number ... \n";
cin >> a;
cout << "\nThanks, now enter a number to add to that...\n";
cin >> b;
(answer = a + b);
cout << " \nAll done, the answer is " << answer <<"\n\n";
}
{
if (choice == 2)
{
cout << "Great, please enter a number ... \n";
cin >> a;
cout << "Thanks, now enter a number to subtract from that...\n";
cin >> b;
(answer = a - b);
cout << " All done, the answer is " << answer <<"\n\n";
}
if (choice == 3)
{
cout << "Great, please enter a number ... \n";
cin >> a;
cout << "Thanks, now enter a number to divide that by...\n";
cin >> b;
(answer = a / b);
cout << " All done, the answer is " << answer <<"\n\n";
}
if (choice == 4)
{
cout << "Great, please enter a number ... \n";
cin >> a;
cout << "Thanks, now enter a number to multiply that by...\n";
cin >> b;
(answer = a * b);
cout << " All done, the answer is " << answer <<"\n\n";
}
system ("PAUSE");
return 0;
}
}
}
| |