#include <iostream.h>
#include<conio.h>
void main()
{
int select , choice , x , y , i ;
clrscr();
cout<<"Enter any two integer values : ";
cin>>x>>y;
cout<<"\nVarious Operators : \n";
cout<<"=================\n";
cout<<"1. Arithmetic\n";
cout<<"2. Relational\n";
cout<<"3. Logical\n";
cout<<"Enter your choice :\n";
cin>>select;
switch (select)
{
case 1 :cout<<"\tMenu-Arithmatic operations\n";
cout<<"1. Addition\n";
cout<<"2. Subtraction\n";
cout<<"3. Division\n";
cout<<"4. Multiplication\n";
cout<<"5. Modulus\n";
cout<<"Enter your choice : ";
cin>>choice;
switch (choice)
{
case 1 : cout<<"Addition of "<<x<<" and "<<y<<" : "<<x+y;
break ;
case 2 : cout<<"Subtraction of "<<x<<" and "<<y<<" : "<<x-y;
break ;
case 3 : cout<<"Division of "<<x<<" and "<<y<<" : "<<float(x)/float(y);
break ;
case 4 : cout<<"Multiplication of "<<x<<" and "<<y<<" : "<<x*y;
break ;
case 5 : cout<<"Modulus of "<<x<<" and "<<y<<" : "<<x%y;
break ;
default : cout<<"Wrong choice !!";
}
break ;
case 2 : cout<<"\tMenu-Relational opeations\n";
cout<<"1. Greater than\n";
cout<<"2. Less than\n";
cout<<"3. Equal to\n";
cout<<"4. Less than or equal to\n";
cout<<"5. Greater thn or equal to\n";
cout<<"Enter your choice : ";
cin>>choice;
switch (choice)
{
case 1 :
cout<<"Result of x greater than y : "<<(x>y);
break ;
case 2 :
cout<<"Result of x less than y : "<<(x<y);
break ;
case 3 :
cout<<"Result of x equal to y : "<<(x==y);
break ;
case 4 :
cout<<"Result of x less than or equal to y : "<<(x<=y);
break ;
case 5 :
cout<<"Result of x greater than or equal to y : "<<(x>=y);
break ;
}
break ;
case 3 : cout<<"\tMenu-Logical operations\n";
cout<<"1. Logical AND\n";
cout<<"2. Logical OR\n";
cout<<"Enter your choice : ";
cin>>choice;
switch (choice)
{
case 1 :
cout<<"Result of x AND y : "<<(x&&y);
break ;
case 2 :
cout<<"Result of x OR y : "<<(x||y);
break ;
}
break ;
}
getch () ;
}
0 comments:
Post a Comment