/*
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