Search This Blog

Friday, 21 August 2020

add,multi,substra,div using operATOR

 #include<iostream>

#include<conio.h>

using namespace std;

int main()

{

char op;

float n1,n2;

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

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

cin>>op ;

cout<<"\n\t\tEnter the 1st number :";

cin>>n1;

cout<<"\n\t\tEnter the 2nd number :";

cin>>n2;

switch(op) 

{

case ('+'):

cout<<"\n\t\tAddition of  '"<<n1<<"'  and  '"<<n2<<"' is  "<<n1+n2;

break;

case ('-') :

cout<<"\n\t\tSubstraction of  '"<<n1<<"'  and  '"<<n2<<"' is "<<n1-n2;

break;

case ('*'):

cout<<"\n\t\tMultiplication of  '"<<n1<<"'  and  '"<<n2<<"' is "<<n1*n2;

break;

case ('/'):

cout<<"\n\t\tDividation of  '"<<n1<<"'  and  '"<<n2<<"' is "<<n1/n2;

break;

default :

    cout<<"\n\t\tErrror! Please Enter The Right Operator:";

}

getch();

return 0;

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts