Making a Calculator By switch statement In Dev C++
Output Shown Like This :
#include<iostream>
using namespace std;
int main()
{
int a,b;
char choice;
cout<<"Enter Value Of a=";
cin>>a;
cout<<"Enter Value Of b=";
cin>>b;
cout<<"Enter +,-,*,/=";
cin>>choice;
switch(choice)
{
case '+':
cout<<"Addition="<<a+b;
break;
case '-':
cout<<"Subrtaction="<<a-b;
break;
case '*':
cout<<"Multiplication="<<a*b;
break;
case '/':
cout<<"Division="<<a/b;
break;
default:
cout<<"Invaliad Number";
break;
}
return 0;
}
No comments:
Post a Comment