#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <cmath>//应用log函数
#define N 100005
#define ll long long
using namespace std;
//printf和cout输出的不同
int main()
{
double t=0.62;
double c=0.32;
int a=t;
int b=c;
cout<< t<<c<<endl;
printf("%.lf %.lf\n",t,c);//输出 1 0
printf("%lf %lf\n",t,c);//输出 0.62 0.32
printf("%d %d\n",a,b);//输出0 0,不会四舍五入
return 0;
c语言四舍五入printf
最新推荐文章于 2024-03-31 22:47:43 发布