D format: used to output decimal integers. There are several uses:
1, %d: output according to the actual length of integer data.
2.% MD: m is the width of the specified output field. If the number of digits of data is less than m, the left end is filled with spaces; If it is greater than m, it is output according to the actual number of digits. ?
3.%ld: output long integer data.
F format: used to output real numbers (including single precision and double precision) as floating-point numbers. There are the following usages:
1, %f: No width is specified, all integer parts are output, and the first 6 digits are output for decimal parts. ?
2.%m.nf: the output * * * occupies m columns, including n decimal places, for example, the width of the value is less than the left end of m, and spaces are filled.
3.%-m.nf: the output * * * occupies n columns, including n decimal places. For example, if the number width is less than the right end of m, spaces are filled.
Extended data
Commonly used formats are:
%o: Output integer as octal unsigned number.
%x, %X: Output integer as hexadecimal unsigned number.
%s: output string.
%c: output a character.
Baidu Encyclopedia-Format Characters