Program to perform a simple calculator using Arithmetic Operator on two numbers using switch case in C++
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
char op;
cout<<"Enter a operator b :";
cin>>a>>op>>b;
switch(op)
{
case '+' :
cout<<a+b;
break;
case '-' :
cout<<a-b;
break;
case '*' :
cout<<a*b;
break;
case '/' :
cout<<a/b;
break;
case '%' :
cout<<a%b;
break;
default :
cout<<"wrong operator";
}
getch();
}
OUTPUT::
Enter a operator b :55-8
47