c++中指定位數的浮點數輸出

在C語言中輸出小數位數代碼以下:html double a = 1.7569; printf("%.2lf\n", a); C++中以下:ios double a = 1.7569; cout << setiosflags(ios::fixed) << setprecision(3) << a << endl; 參考博客:http://www.cnblogs.com/wushuaiyi/p/443
相關文章
相關標籤/搜索