The number must be displayed with exactly five digits after the decimal. If the number is 0 to display only 0 instead of 0.00000. If the number has zeros in his decimal recording only show numbers other than zero, for example 0.08500 instead of outputting 0.085 //s0 is my variable
if (s0==) cout<<"0"
else cout<<setiosflags(ios::fixed)<<setprecision(5)<<s0;
Try:
In your version
setiosflags(ios::fixed)
is forcing trailing zeros.