Home / Tech / How to Create Simple Calculator in C++ Program
How to Make Simple Calculator in C++ Program

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

1

2

#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

Addition

Subtraction Answer

Subtraction

Multiplication Answer

Multiplication

Division Answer

Division

Read Also: How to install Turbo C++: Compile and Run a C++ Program

About Jahanzaib Khan

A Passionate Bloggers from Pakistan, Who Loves to Put Content That Talks About The Reality of Current Situations.

Check Also

Facebook is Now Closer into Building Your Virtual Copy

Facebook is Now Closer into Building Your Virtual Copy

Whenever, it comes to social media platforms to represent yourself, it’s actually who you portray …

Leave a Reply

Your email address will not be published. Required fields are marked *