C++的精度设置
C++的小数点后几位的四舍五入
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(3);
cout << maxvalue << endl;
等同于C语言的
printf( "%.3lf\n", maxvalue );
C++的小数点后几位的四舍五入
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(3);
cout << maxvalue << endl;
等同于C语言的
printf( "%.3lf\n", maxvalue );
相关文章: