Search This Blog

Saturday, 8 December 2012

Simple calculator using c++

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double num1;
double num2;
char operation;
cout<<"Enter the first no:";
cin>>num1;
cout<<"Enter the operation:";
cin>>operation;
cout<<"Enter the second no:";
cin>>num2;
switch(operation)
{
case '+':
cout<<"the addition value is:"<<num1+num2;
break;
case '-':
cout<<"the subtraction value is:"<<num1-num2;
break;
case '*':
cout<<"the multiplication value is:"<<num1*num2;
break;
case "/":
cout<<"the division value is:"<<num1/num2;
break;
}
getch();
}

Output:
Enter the first no:23
Enter the operation:+
Enter the second no:23
the addition value is:46


No comments:

Post a Comment