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)

允许在浮点数和十六进制整数输出中使用大写字符。对输入无影响。

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 标志
(函数)