12-03-2009, 11:01 AM
Code:
#include <iostream>
using namespace std;
int main()
{
int a,b;
int option;
cout << ":::Calculator v1::: \n";
cout << "Enter a Number: \n";
cin >> a;
cout << "Enter a Number: \n";
cin >> b;
cout << "1. Multiplication \n";
cout << "2. Division \n";
cout << "3. Addition \n";
cout << "4. Subtraction \n";
do {
cout << "Enter your choice: ";
cin >> option;
} while(option<1 || option>4);
switch (option) {
case 1:
cout << "The Result is: " << a*b;
break;
case 2:
cout << "The Result is: " << a/b;
break;
case 3:
cout << "The Result is: " << a+b;
break;
case 4:
cout << "The Result is: " << a-b;
break;
}
while(option!=4)
return 0;
}