#include<stdio.h> #include<math.h> double change(double n){ return round(n * 100) / 100; } int main(){ double n; while(scanf("%lf",&n)!= EOF){ printf("%.2f",change(n)); } return 0; }
即:将浮点数乘 100,求其四舍五入整数,然后除以100,便可得到 相对应的值
原文地址:https://www.cnblogs.com/expedition/p/12318349.html
时间: 2024-08-04 13:11:48