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 );
转载于:https://www.cnblogs.com/agpro/archive/2010/06/23/1763613.html