Search This Blog

Friday, 21 August 2020

Calculator using operator cace :

 #include<iostream>

using namespace std;

int main()

{

char op;

float n1,n2;

cout<<"\n\n\n\nTHIS IS MINI CALCULATOR AND HERE YOU CAN MAKE CALCULATIONS USING SIMPLE OPARATOR LIKE ";

cout<<"\n\n\n\n\nWhat do you want to done either + or - or * or /  :"<<ends;

cin>>op ;

cout<<"\n\nEnter the 1st number :";

cin>>n1;

cout<<"\n\nEnter the 2nd number :";

cin>>n2;

switch(op) 

{

case ('+'):

cout<<"\n\nAddition of   "<<n1<<"  and  "<<n2<<" is  "<<n1+n2;

break;

case ('-') :

cout<<"\n\nSubstraction of  "<<n1<<" and "<<n2<<" is "<<n1-n2;

break;

case ('*'):

cout<<"\n\nMultiplication of  "<<n1<<" and "<<n2<<" is "<<n1*n2;

break;

case ('/'):

cout<<"\n\nDividation of  "<<n1<<" and "<<n2<<" is "<<n1/n2;

break;

default :

    cout<<"Errror! Please Enter The Right Operator:";

}

return 0;

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts