一、保留有效数字的问题

1 #include<iostream>
2 #include<iomanip>
3 #include "stdlib.h"
4 using namespace std;
5 int main(){
6     double PI=3.1415926;
7     cout<<setprecision(3)<<PI<<endl;
8     return 0;//3.14三位有效数
9 }

二、保留有效数字

1  cout<<setiosflags(ios::fixed)<<setprecision(3)<<ans<<endl;//三位小数

 

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2021-10-12
  • 2021-12-27
  • 2021-12-12
  • 2021-06-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2022-02-27
  • 2021-12-02
相关资源
相似解决方案