C++ iomanip setiosflags() Function
Example
Turn on the fixed flag:
cout << setiosflags(ios::fixed) << setprecision(2) << 3.14159;
Definition and Usage
The setiosflags() function turns on one or more format flags for the output.
setiosflags(ios::fixed) does the same as fixed. In most cases, it is easier to use the short manipulators, like fixed and left.
The setiosflags function is defined in the <iomanip> header file.
Tip: Use resetiosflags() to turn the flags off again.
Syntax
setiosflags(ios::fmtflags flags)
Parameter Values
| Parameter | Description |
|---|---|
| flags | Required. The flags to turn on, like ios::fixed, ios::left or ios::showpoint. Combine several flags with |. |
Technical Details
| Returns: | A manipulator that you use with <<. |
|---|