2 回答

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊
C++里標(biāo)準(zhǔn)輸入輸出使用的格式化標(biāo)志之一
如:
setf (ios_base: :showpoint)//是設(shè)置小數(shù)點(diǎn)模式
就是說,設(shè)定為showpoint后,在不必要的時(shí)候也顯示10進(jìn)數(shù)的小數(shù)點(diǎn)以及其后的0
參考例子:
// modify showpoint flag
#include <iostream>
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;
return 0;
}
The execution of this example displays something similar to:
30.000 10000. 3.1416
30 10000 3.1416
- 2 回答
- 0 關(guān)注
- 1214 瀏覽
添加回答
舉報(bào)