C++ nouppercase Manipulator

Beginner
5 min read
Updated: Nov 2026
3 examples
iostream

Definition

In C++, nouppercase turns off uppercase. After it, hexadecimal digits print as a to f, and scientific notation uses a small e.

This is the default, so it matters only after you used uppercase. It comes from <ios>, which <iostream> includes.

This is a manipulator. You do not call it on its own. You send it into a stream with << or >>, and it changes how that stream behaves from then on (or does one small job, like ending a line).

Syntax

Put std::nouppercase into the stream.

C++
std::cout << std::hex << std::uppercase << 255;     // FF
std::cout << std::nouppercase << 255;               // ff
CallWhat it does
std::cout << std::nouppercaseSmall letters in numbers from now on.
std::cout << std::hex << std::nouppercase << 255Prints ff.
std::cout << std::scientific << std::nouppercase << 1500.0Prints 1.500000e+03.

It has no effect on text. It changes only letters that belong to numbers.

Library declarations
C++
ios_base& nouppercase(ios_base& str);

Parameters

ParameterDescription
strThe stream. It is passed in for you when you write cout << nouppercase. You never write this argument yourself.

Return Value

Return ValueDescription
ios_base&A reference to the same stream, so you can keep chaining << or >> after nouppercase.

C++ Examples

Example 1 — Switch Hex Back to Small Letters

Print one value, change the setting, and print it again.

C++
#include <iostream>

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

How It Works

  1. With hex and uppercase, 255 prints as FF.
  2. nouppercase turns the capitals off, but hex stays on.
  3. The second line prints the same number as ff.

Example 2 — Lower-Case e in Scientific Notation

The exponent letter changes back from E to e.

C++
#include <iostream>

int main() {
    std::cout << std::scientific << std::uppercase << 12345.678 << '\n';
    std::cout << std::nouppercase << 12345.678 << '\n';
    return 0;
}

How It Works

  1. scientific with uppercase prints the exponent as E.
  2. nouppercase comes in the middle of the second statement and turns the capital off.
  3. The same number now prints with a small e.

Example 3 — Print a Word in Hex Both Ways

BEEF and beef are the same number written two ways.

C++
#include <iostream>

int main() {
    int value = 48879;

    std::cout << std::hex;
    std::cout << std::uppercase << value << ' ';
    std::cout << std::nouppercase << value << '\n';
    return 0;
}

How It Works

  1. hex is set once at the top and stays on.
  2. The first value is printed with capitals: BEEF.
  3. nouppercase is put in before the second one, which prints as beef. Both mean 48879.

Frequently Asked Questions

It turns off uppercase, so hex digits and the e of scientific notation are printed in small letters.
Yes. Numbers print with small letters unless you turn uppercase on.
No. It only changes letters that are part of printed numbers.
Put std::nouppercase into the stream. The base stays hex until you change it.
cout.unsetf(std::ios::uppercase) has the same effect.

Next: oct

Read and print integers in base 8.

oct tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

14 people found this page helpful