1、包含头文件<iomanip>,附注manip是manipulator,操控的简写。

2、第一种写法:

cout<<setiosflags(ios::fixed)<<setprecision(2);

第二种写法:

cout.setf(ios::fixed);
cout<<setprecision(2);

第三种写法:

cout<<fixed<<setprecision(2);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2022-01-06
  • 2022-01-01
  • 2022-12-23
  • 2021-09-14
猜你喜欢
  • 2021-08-04
  • 2021-12-06
  • 2021-11-30
  • 2022-12-23
  • 2021-11-18
  • 2021-08-24
相关资源
相似解决方案