C++ Program to make calculator using switch case and the program should continue as user wants

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,b,c;
char op,ch1;
do
{
cout<<"enter first number ::: ";
cin>>a;
cout<<"enter second number ::: ";
cin>>b;
cout<<"enter the operator ::: ";
cin>>op;
switch(op)
{             case '+': c=a+b;
cout<<"The Calculated result is ::: "<<c;
break;
 case '-':  c=a-b;
    cout<<"The Calculated result is ::: "<<c;
    break;
    case '*':  c=a*b;
cout<<"The Calculated result is ::: "<<c;
break;
case '/':  c=a/b;
  cout<<"The Calculated result is ::: "<<c;
  break;
default:
cout<<"wrong operator used";
cin>>ch1;
}//switch statement close
cout<<"\nDo you want to continue(y/n) :: ";
         cin>>ch1;
}while(ch1=='y' || ch1=='Y');
getch();
}




THE OUTPUT OF ABOVE PROGRAM WILL BE....





     









HERE IS THE VIDEO BY ME ::






Comments

Popular posts from this blog

List of Devices that will get Lineage OS 14.1 ROM

How to make pascal's triangle using for loop in c++

C++ Function to edit a particular record in a binary file