Namespaces
Variants

std:: uppercase, std:: nouppercase

From cppreference.net
< cpp ‎ | io ‎ | manip
Input/output manipulators
Floating-point formatting
Integer formatting
Boolean formatting
Field width and fill control
Other formatting
uppercase nouppercase
Whitespace processing
Output flushing
Status flags manipulation
Time and money I/O
(C++11)
(C++11)
(C++11)
(C++11)
Quoted manipulator
(C++14)
定義先ヘッダ <ios>
std:: ios_base & uppercase ( std:: ios_base & str ) ;
(1)
std:: ios_base & nouppercase ( std:: ios_base & str ) ;
(2)

浮動小数点および16進整数の出力において大文字の使用を有効にします。入力には影響しません。

1) ストリーム str uppercase フラグを有効にする。 str. setf ( std:: ios_base :: uppercase ) を呼び出した場合と同様の効果を持つ。
2) ストリーム str uppercase フラグを無効化します。これは str. unsetf ( std:: ios_base :: uppercase ) を呼び出した場合と同様です。

これはI/Oマニピュレータであり、 out << std :: uppercase のように、 out std::basic_ostream 型の場合に呼び出すことができます。また、 in >> std :: uppercase のように、 in std::basic_istream 型の場合にも呼び出すことができます。

目次

パラメータ

str - 参照するI/Oストリーム

戻り値

str (操作後のストリームへの参照)。

#include <iostream>
int main()
{
    std::cout << std::hex << std::showbase
              << "0x2a with uppercase: " << std::uppercase << 0x2a << '\n'
              << "0x2a with nouppercase: " << std::nouppercase << 0x2a << '\n'
              << "1e-10 with uppercase: " << std::uppercase << 1e-10 << '\n'
              << "1e-10 with nouppercase: " << std::nouppercase << 1e-10 << '\n';
}

出力:

0x2a with uppercase: 0X2A
0x2a with nouppercase: 0x2a
1e-10 with uppercase: 1E-10
1e-10 with nouppercase: 1e-10

関連項目

指定された ios_base フラグをクリア
(関数)
指定された ios_base フラグを設定
(関数)