Need a project done?

C++ Programming Developer

Search This Blog

Program to make Simple Calculator in C++.


/*
Simple Calculator. Write the expression as you write in your calculator. Can only handle 2 variables.
*/
#include <iostream>
using namespace std;

void main()
{
double x,y;char o;
cin>>x>>o>>y;
if (o == '+')
cout << x+y;
else
if (o == '-')
cout <<x-y;
else
if (o == '*')
cout <<x*y;
else
if (o=='/')
cout << x/y;
else
cout <<"Sntax Error!";
}

No comments:

Post a Comment

"Don't let anyone ever make you feel like you don't deserve what you want."