Tutorial by Examples

int val = 10; // val will be printed to the extreme left end of the output console: std::cout << val << std::endl; // val will be printed in an output field of length 10 starting from right end of the field: std::cout << std::setw(10) << val << std::endl; This ...
When used in an expression out << setprecision(n) or in >> setprecision(n), sets the precision parameter of the stream out or in to exactly n. Parameter of this function is integer, which is new value for precision. Example: #include <iostream> #include <iomanip> #include...
When used in an expression out << setfill(c) sets the fill character of the stream out to c. Note: The current fill character may be obtained with std::ostream::fill. Example: #include <iostream> #include <iomanip> int main() { std::cout << "default fill: &quo...
When used in an expression out << setiosflags(mask) or in >> setiosflags(mask), sets all format flags of the stream out or in as specified by the mask. List of all std::ios_base::fmtflags : dec - use decimal base for integer I/O oct - use octal base for integer I/O hex - use hexade...

Page 1 of 1