%a(%A) floating-point number, hexadecimal number and p-(P-) notation (C99)
%c character
%d signed decimal integers
%f floating-point numbers (including float and doulbe)
%e(%E) floating-point exponent output [e-(E-) notation]
%g(%G) floating-point numbers do not display meaningless zero "0".
%i signed decimal integer (same as %d)
%u unsigned decimal integers
%o octal integer, such as 0 123.
%x(%X) hexadecimal integer 0f(0F), such as 0x 1234.
%p pointer
%s string
%% "%"
mark
Left alignment: "-"For example, "%-20s"
Right alignment: "+"For example: "%+20s"
Spaces: If the symbol is positive, spaces will be displayed; If it is negative, a "-"sign will be displayed, for example, "%6.2f".
#: It has no influence on classes C, S, D and U; For class o, prefix o when outputting; For class X, the prefix 0x is output;
For classes E, G, F, G and F, the decimal point is given only when the result has a decimal point.
3. Format string (format)
[Mark] [Output Minimum Width] [. Accuracy] [Length] type
"%-MD": Left-aligned. If m is less than the actual value, it is output according to the actual value.
"%m.ns": output m bits, take n bits of the string (from the left), and fill in the space on the left. When n >; When m or m is omitted, m = n.
For example, "%7.2s" is entered into China.
Output "CH"
"%m.nf": outputs floating-point numbers, where m is the width and n is the number to the right of the decimal point.
For example, "%3. 1f" enters 3852.99.
Output 3853.0
Length: h short molding quantity, l long molding quantity.
Article source:/course/3 _ program/C++/CPPJS/200869/123898.html.