#include<iostream>
#include<math.h>
using namespace std;
int main ()
{
int choice;
float a,b,c;
cout<<"\t\t\t**SELECT CHOICE** \n '1' for addition\n '2' for subtraction\n '3' for multiplication\n '4' for division" <<endl<<endl<<endl;
cout<<"Enter your Choice : ";
cin>>choice;
cout<<"\n\nEnter first number : ";
cin>>a;
cout<<"Enter second number :";
cin>>b;
cout<<endl<<endl;
switch (choice)
{
case 1:
c=a+b;
cout<<"Addition is : "<<c <<endl;
break;
case 2:
c=a-b;
cout<<"Subtraction is : "<<c <<endl;
break;
case 3:
c=a*b;
cout<<"Multiplication is : "<<c <<endl;
break;
case 4:
if(b==0)
cout<<"Undefined";
else
{
c=a/b;
cout<<"Division is : "<<c <<endl<<endl;
}
break;
}
system("pause");
return 0;
}
0 comments:
Post a Comment