#include <bits/stdc++.h> using namespace std; int main(){ //保留3位有效数字?(四舍五入)-> cout cout<<setprecision(3)<<3.004<<endl; //精确小数点后三位(四舍五入) -> cout cout<<fixed<<setprecision(3)<<3.0135<<endl; //精确小数点后三位(四舍五入) -> printf //int %d float %f double %lf char %c string %s printf("%1.3f\n%1.3f\n%s",3.0015,3.0049,"45612348"); cout<<1111<<"\n"<<2222;//\n 换行符 freopen("","r",stdin);//文件路径+文件名 文件的打开方式 标准输入输出 freopen("","w",stdout); int n; cin<<n; cout<<n; fclose(stdin);//关闭输入文件 fclose(stdout);//关闭输出文件 return 0; }
标签:cout,1.3,int,输入输出,n%,printf From: https://www.cnblogs.com/boyeyuan/p/18148606