標籤:
1 dec
2 fixed
3 hex
4 internal
5 left
6 oct
7 right
8 scientific
9 showbase
10 showpoint
11 showpos
12 skipws
13 stdio
14 unitbuf
15 uppercase
1 dec
轉換基製為十進位
1 #include <iostream> 2 3 void main() 4 { 5 int num = 01070;//八進位 6 7 std::cout << num << std::endl;//輸出十進位 8 9 std::cout << std::hex;//十六進位強制標識,endl結束不了10 std::cout << num << std::endl;//輸出十六進位11 12 std::cout << std::oct;//八進位強制標識,endl結束不了13 std::cout << num << std::endl;//輸出八進位14 15 std::cout << std::dec;//十進位16 std::cout << num << std::endl;//輸出十進位17 18 system("pause");19 }
2 fixed
定點形式顯示浮點數
3 hex
轉換基製為十六進位
4 internal
在符號位和基指示符後填入字元
5 left
靠左對齊輸出
1 #include <iostream> 2 3 void main() 4 { 5 std::cout.width(40);//設定顯示的寬度 6 std::cout.fill(‘&‘);//填充字元 7 std::cout.setf(std::ios::left);//靠左對齊 8 9 std::cout << "hello world" << std::endl;10 11 system("pause");12 }
6 oct
轉換基製為八進位
7 right
靠右對齊輸出
8 scientific
科學示數法顯示浮點數
9 showbase
在輸出中顯示基指示符
10 showpoint
輸出時顯示小數點
11 showpos
正整數前加“+”號
12 skipws
跳過輸入中的空白
13 stdio
輸出操作後重新整理stdout和stdree
14 unitbuf
輸出操作後立即重新整理流
15 uppercase
十六進位輸出時一律用大寫字母
ios的標誌常量