Ext.: http://blog.csdn.net/ouczoe/article/details/4923413
The input and output stream is defined in <iostream> and the standard console output stream is also declared in this header file cout
Header file with control: standard header file <ios> and <iomanip>
Output stream:
Boolalpha and Noboolalpha: notifies the output stream to output bool as true and False (Boolalpha) or 1 and 0 (noboolalpha). The default is Noboolalpha.
Hex,oct,dec: 16 binary, 8 binary, 10 binary output digits respectively.
Setprecision: Sets the number of decimal places to output decimals (several after the decimal point). For example, Setprecision (5)--Take 5 digits after the decimal point.
SETW: Sets the width of the field when outputting numeric data. e.g. SETW (5).
Setfill: When the width of the number is less than the width of the set, the control can make the characters that fill the empty space. Setfill (' a ').
Showpoint and Nonshowpoint: for floating-point or double-precision numbers without fractional parts, this control forces the flow to always display decimals or not display decimals.
Endl: Encapsulates data and behavior. The number of notification flows outputs a carriage return and refreshes its buffer output.
These controls are written in front of the output parameters that need to function, such as COUT<<SETW (7) <<setfill (' & ') <<variable<<endl;
e.g. #include <iostream>
#include <iomanip>
using namespace Std;
int main (int argc, char** argv)
{
bool Testb = true;
cout<< "This is a testing of bool" <<boolalpha<<testB<<endl;
}
Input stream:
Boolalpha and Noboolalpha: the string True,false interpreted as Boolean true and False for input save (boolalpha). Noboolalpha won't explain that. The default is Noboolalpha.
Hex,oct,dec: The numbers are read in 16, 8, and 10 respectively.
Skipwa and Noskipwa: The notification flow ignores whitespace characters when doing lexical analysis or reads whitespace into tokens as a whitespace character.
WS: Traverse the control character. Ignores a string of whitespace at the current position in the stream.
C + + iostream