cout « Development « C++ Tutorial






5.2.cout
5.2.1.parameterless manipulators that operate on output streams
5.2.2.To use a parameterized manipulator, you must include . It defines the following manipulators:
5.2.3.Using Manipulators to Format I/O
5.2.4.Use std::cout to output message to console
5.2.5.Use std::cout to output various data
5.2.6.Printing a line of text with multiple statements
5.2.7.Use std::endl to output a new line sign
5.2.8.cout: unsetf
5.2.9.Printing multiple lines of text with a single statement: use the \n








5.2.10.Output a pointer
5.2.11.Use function in cout statement
5.2.12.cout: setf()
5.2.13.cout: flags() and unsetf()
5.2.14.cout: width()
5.2.15.cout: precision()
5.2.16.cout: fill()
5.2.17.Using write().
5.2.18.An I/O manipulator: cout << setprecision(2)
5.2.19.An I/O manipulator: cout << setw(20)








5.2.20.use the setiosflags( ) manipulator to directly set the various format flags related to a stream.
5.2.21.cout: setiosflags()
5.2.22.Skip leading whitespace.
5.2.23.Scientific mode; don't show plus sign anymore
5.2.24.Fixed-point mode, show a '+' for positive nums, show 3 digits to the right of the decimal
5.2.25.setiosflags(ios::showpos); and setiosflags(ios::showbase);
5.2.26.ios::showpos | ios::showbase | ios::oct | ios::right
5.2.27.Set cout to output hex
5.2.28.Show default condition of format flags
5.2.29.cout.setf(ios::showpoint | ios::showpos, ios::showpoint);
5.2.30.Set ios::showpoint, ios::showpos for double pointer number
5.2.31.OR together two or more flags
5.2.32.unset flag one by one
5.2.33.cout boolalpha: cause bool values to display as true or false
5.2.34.Demonstrating the flags member function
5.2.35.Using showpoint to control the printing of trailing zeros anddecimal points for doubles
5.2.36.Demonstrating left justification and right justification
5.2.37.Printing an integer with internal spacing and plus sign
5.2.38.Using stream-manipulator showbase to show number base
5.2.39.Stream-manipulator uppercase.
5.2.40.Demonstrating stream-manipulators boolalpha and noboolalpha.
5.2.41.Controlling precision of floating-point values.
5.2.42.Check cout flags