如何输出精确到小数点后N位的小数

1   #include <iomanip>

double num = 1.6090123;
2 
3 //输出num精确到小数点后三位
4 
5 cout << std::fixed << std::setprecision(3) << num << endl;

 

posted @ 2014-03-09 14:30  向日葵的祈愿  阅读(424)  评论(0)    收藏  举报