摘要: 保留小数 printf("%.nf",number); //比如,把n换成2就是保留2位小数 另一种方法: cout<<setprecision(n)<<std::fixed<<number<<endl; //加上std::fixed就是小数点后保留n位 //或者 //不加fixed的话就是全部的有 阅读全文
posted @ 2024-03-26 18:41 SaTsuki26681534 阅读(8) 评论(0) 推荐(0) 编辑