ios的標誌常量

來源:互聯網
上載者:User

標籤:

 

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的標誌常量

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.