标签: c++ xcode
我试图在我的项目上实现C ++代码,并且我试图用2位小数格式化浮点数。这是我的代码:
float number = 15.101010101010; cout << fixed << setprecision(2);
但是我收到了这个错误:
Use of undeclared identifier setprecision
你们中的任何人都知道为什么我会收到这个错误或者如何修复?
我非常感谢你的帮助。
答案 0 :(得分:2)
包含iomanip标题以使用std::setprecision。
iomanip