就是說琅绅,設定為showpoint后豌研,在不必要的時候也顯示10進數的[小數點]以及其后的0
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double a, b, pi;
a = 30.0;
b = 10000.0;
pi = 3.1416;
cout.precision(5); //設置輸出長度
cout << showpoint << a << '\t' << b << '\t' << pi << endl;
cout << noshowpoint << a << '\t' << b << '\t' << pi << endl;
}
//輸出
30.000 10000. 3.1416
30 10000 3.1416