C++ ios庫 - nouppercase 函式



描述

它用於設定str流的大寫格式標誌。當設定大寫格式標誌時,在涉及流生成的字母的輸出操作(如某些十六進位制表示和數字基數字首)中,將使用大寫字母代替小寫字母。

宣告

以下是std::uppercase函式的宣告。

ios_base& uppercase (ios_base& str);

引數

str − 受影響的流物件的格式標誌。

返回值

它返回引數str。

異常

基本保證 − 如果丟擲異常,str處於有效狀態。

資料競爭

它修改str。對同一流物件的併發訪問可能會導致資料競爭。

示例

下面的例子解釋了std::uppercase函式。

#include <iostream>

int main () {
   std::cout << std::showbase << std::hex;
   std::cout << std::uppercase << 77 << '\n';
   std::cout << std::nouppercase << 77 << '\n';
   return 0;
}

讓我們編譯並執行上面的程式,這將產生以下結果:

0X4D
0x4d
ios.htm
廣告
© . All rights reserved.