1. Home
  2. Computing & Technology
  3. C / C++ / C#

Learn About Input and Output

By , About.com Guide

3 of 8

List of cout Manipulators

Manipulators can be defined in input or output streams. These are objects that return a reference to the object and are placed between pairs of <<. Most of the manipulators are declared in <ios>, but endl, ends and flush come from <ostream>. Several manipulators take one parameter and these come from <iomanip>.

Here's a more detailed list.

From <ostream>

  • endl - Ends the line and calls flush.
  • ends - Inserts '\0' ( NULL) into the stream.
  • flush - Force the buffer to be output immediately.
From <ios>. Most are declared in <ios_base> the ancestor of <ios>. I've grouped them by function rather than alphabetically.

  • boolalpha - Insert or extract bool objects as "true" or "false".
  • noboolalpha - Insert or extract bool objects as numeric values.

  • fixed - Insert floating-point values in fixed format.
  • scientific - Insert floating-point values in scientific format.

  • internal - Internal-justify.
  • left - Left-justify.
  • right - Right-justify.
  • dec - Insert or extract integer values in decimal format.
  • hex - Insert or extract integer values in hexadecimal (base 16) format.
  • oct - Insert or extract values in octal (base 8) format.

  • noshowbase - Do not prefix value with its base.
  • showbase - Prefix value with its base.
  • noshowpoint - Do not show decimal point if not necessary.
  • showpoint - Always show decimal point when inserting floating-point values.
  • noshowpos - Don't insert plus sign (+) if number >= 0.
  • showpos - Do insert plus sign (+) if number >=0.
  • noskipws - Do not skip initial white space on extracting.
  • skipws - Skip initial white space on extracting.
  • nouppercase - Don't replace lowercase letters by uppercase equivalents.
  • uppercase - Replace lowercase letters by uppercase equivalents.

  • unitbuf - Flush buffer after an insert.
  • nounitbuf - Don't flush buffer after each insert.

On the next page Examples of using cout.

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. C++
  5. Learn C++ Programming
  6. Lists of cout Manipulators

©2009 About.com, a part of The New York Times Company.

All rights reserved.