Stream manipulator uppercase outputs an uppercase X
or E
with hexadecimal-integer values or with scientific notation floating-point values, respectively (Fig. 13.19). Using stream manipulator uppercase
also causes all letters in a hexadecimal value to be uppercase. By default, the letters for hexadecimal values and the exponents in scientific notation floating-point values appear in lowercase. To reset the uppercase
setting, output the stream manipulator nouppercase.
1 // Fig. 13.19: fig13_19.cpp
2 // Stream manipulator uppercase.
3 #include <iostream>
4 using namespace std;
5
6 int main()
7 {
8 cout << "Printing uppercase letters in scientific" << endl
9 << "notation exponents and hexadecimal values:" << endl;
10
11 // use std:uppercase to display uppercase letters; use std::hex and
12 // std::showbase to display hexadecimal value and its base
13 cout << uppercase << 4.345e10 << endl
14 << hex << showbase << 123456789 << endl;
15 } // end main
Printing uppercase letters in scientific
notation exponents and hexadecimal values:
4.345E+010
0X75BCD15