1value = round( value * 100.0 ) / 100.0; // 2 decimal places
2value = round( value * 1000.0 ) / 1000.0; // 3 decimal places
1 float a,b,c,d,sum;
2
3 cin>>a>>b>>c>>d; // reading decimal values
4
5sum=(a*b*c*d);
6
7sum=round(sum*100)/100; // here it is for 2 decimal points
8
9if((float)sum < (float) 9.58)
10 cout<<"YES\n";
11else
12 cout<<"NO\n";
13
1double d = 0.12345;
2std::cout.precision(2); // for accuracy to 2 decimal places
3std::cout << d << std::endl; // 0.12