保留位数

tctm132 睿智 2023-02-03 10:38:23 19

cout<<fixed<<setprecision()<<x;

{{ vote && vote.total.up }}

共 4 条回复

tctm385 赵老师真帅

用<bits/stdc++.h>万能头文件和printf保留位数就OK

tctm151

cout<<fixed<<setprecision()<< ;

tctm103

神马<stdio.h>,直接用<bits/stdc++.h>得了

wangyuzhe 蒟蒻

第2种:

printf("%.1lf", 变量); //1可以替换成保留的位数,需要<stdio.h>头文件