Máy tính bỏ túi cơ bản
Code:
#include <bits/stdc++.h>
using namespace std;
int main()
{
double a,b;
cin>>a;
char x;
cin>>x;
cin>>b;
if(x == '+')
cout<<fixed<<setprecision(2)<<a+b;
if(x == '-')
cout<<fixed<<setprecision(2)<<a-b;
if(x == '*')
cout<<fixed<<setprecision(2)<<a*b;
if(x == '/')
{
if(b != 0)
cout<<fixed<<setprecision(2)<<a/b;
if(b == 0)
cout<<"Math Error";
}
return 0;
}