c++ 如何输出大数不用科学计数法 和如何保留几位小数输出

#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;

int main()
{
    int n ;
    while(cin >> n && n)
    {
      //  cout << std::fixed;
        std::cout << std::fixed;<span style="white-space:pre">		</span>//不用科学计数法
        std::cout.precision(0);<span style="white-space:pre">		</span>//保留一位小数
<span style="white-space:pre">	</span>//cout << setprecision(3) << endl;
        cout << pow(3.0 , n) << endl;
    }
    return 0;
}

你可能感兴趣的:(c++ 如何输出大数不用科学计数法 和如何保留几位小数输出)