If you want to use a controller in a program, you must add the iomanip header file in addition to the iostream header file at the beginning of the file.
Role of a controller
Dec sets the base number of the value to 10.
Hex sets the base number of a value to 16.
Oct sets the base number of the value to 8.
Setfill (c) sets the padding character of the next output to C, and C can be a character constant or a character variable.
Setprecision (n) sets the floating point precision to N bits. N represents a valid number when output in decimal form. When output in the fixed (fixed decimal scale) form and scientific (exponential) form, n is the decimal point
SETW (n) sets the field width of the next output to N bits (equivalent to the form of printf ("% 5d", n) in C)
Setiosflags (IOs: fixed) is used to set the floating point to display at a fixed number of decimal places.
Setiosflags (IOs: Scientific) is used to set floating point numbers to be displayed in scientific notation (exponential form ).
Setiosflags (IOs: Left) Left-aligned output data
Setiosflags (IOs: Right) Right-aligned output data
Setiosflags (IOs: skipws) ignores leading Spaces
Setiosflags (IOs: uppercase) data is output in hexadecimal notation with uppercase letters (lower case letters by default)
Setiosflags (ios: lowercase) data is output in hexadecimal notation with lowercase letters
Setiosflags (ios: showpos) returns the "+" when a positive number is output.
Except setfill () and setw (), the output is valid after these options are set. Setfill () and setw () are only valid for the subsequent output.
[Question] It seems that dec, hex, and oct are invalid for floating point numbers. Which prawns can explain?