cout<<setprecision(6)<<fixed<<ans<<endl;
c++输出保留固定小数位数
原文:http://www.cnblogs.com/wuxiangli/p/6366565.html