printf()和coutC++有什么区别?
printf()
cout
c++ printf iostream cout stdio
我有一个float值列表,我想cout用2位小数打印它们.
float
例如:
10.900 should be printed as 10.90 1.000 should be printed as 1.00 122.345 should be printed as 122.34
我怎样才能做到这一点?
(setprecision似乎没有帮助.)
setprecision
c++
c++ ×2
cout ×1
iostream ×1
printf ×1
stdio ×1