//please help me to improve my mistake.
#include
using namespace std;
int main()
{
double a,b=0;
char c=0;
cin>>a>>b;
cin>>c;
switch©
{
case ‘+’:
cout<<a+b;
break;
case ‘-’ :
cout<<a-b;
break;
case '’:
cout<<ab;
break;
case ‘/’:
cout<<a/b;
break;
default:
cout<<“wrong input\n”;
}
return 0;
}
you have to set the precision after floating point
#include<iostream>
#include<bits/stdc++.h>
using namespace std; int main() { double a,b=0;
char c=0; cin>>a>>b; cin>>c;
cout<<fixed;
cout<<setprecision(9);
switch(c) { case '+': cout<<a+b; break;
case '-' : cout<<a-b; break;
case '*': cout<<a*b; break;
case '/': cout<<a/b; break;
default: cout<<"wrong input\n";
}
return 0; }