Showing posts with label simple. Show all posts
Showing posts with label simple. Show all posts

Sunday, 11 October 2015

Simple calculator using switch case

#include <iostream>

using namespace std;

int main()
{long first,second;
char ch;
cout<<"ENTER FIRST INTEGER:";
cin>>first;
cout<<"ENTER SECOND INTEGER";
cin>>second;
cout<<"ENTER THE OPERAND";
cin>>ch;
switch(ch)
{
     case '+' : cout<<"THE SUM IS:"<<first +second;
                break;
     case '-' : cout<<"THE DIFFERENCE IS:"<<first -second;
                break;
     case '/' : cout<<"THE QUOTIENT IS:"<<first/second;
                cout<<"THE REMAINDER IS:"<<first%second;
                break;
     case '*' : cout<<"THE PRODUCT IS:"<<first*second;
                break;

}

}