TechUncategorized
How to Create Simple Calculator in C++ Program
How to Create Simple Calculator in C++ Program (TurboC++): Hello, Everyone today i am going to share with You guys that how to Create Simple Calculator in C++ Program (TurboC++). This Program will takes an Arithmetic Operator Such as (+,-,/,*).1
How to Create Simple Calculator in C++ Program
#include<iostream.h> #include<conio.h> void main() { clrscr(); float a,b; char op; cout<<endl<<“Enter the first value=”;cin>>a; cout<<endl<<“Enter the Second value=”;cin>>b; cout<<endl<<“Enter the Operator (+,-,/,*)=”;cin>>op; if (op==’-‘) cout<<endl<<“Subtraction Answer=”<<a-b; else if (op==’+’) cout<<endl<<“Addition Answer=”<<a+b; else if (op==’*’) cout<<endl<<“Multiplication Answer=”<<a*b; else if (op==’/’) cout<<endl<<“Division Answer=”<<a/b; else cout<<endl<<“You entered Invalid operator”; getch(); } |
Addition Answer
Subtraction Answer
Multiplication Answer
Division Answer
Read Also: How to install Turbo C++: Compile and Run a C++ Program