标签:int cout return oat odi field ++ pre c++
cout.precision(5);
数字表示小数点位数
// modify precision
#include <iostream> // std::cout, std::ios
int main () {
double f = 3.14159;
std::cout.unsetf ( std::ios::floatfield ); // floatfield not set
std::cout.precision(5);
std::cout << f << ‘\n‘;
std::cout.precision(10);
std::cout << f << ‘\n‘;
std::cout.setf( std::ios::fixed, std:: ios::floatfield ); // floatfield set to fixed
std::cout << f << ‘\n‘;
return 0;
}
标签:int cout return oat odi field ++ pre c++
原文地址:https://www.cnblogs.com/lion-zheng/p/10357785.html