cout控制输出浮点数小数点后位数

保留小数点后两位:

cout.precision(2);
cout << fixed << val;

转载于:https://www.cnblogs.com/ray-coding-in-rays/p/6506873.html

    原文作者:weixin_34112030
    原文地址: https://blog.csdn.net/weixin_34112030/article/details/93610926
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞