Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What do the words %d and %f mean?
What do the words %d and %f mean?
%d refers to the output in the form of signed decimal integer according to the actual length, %8.6f refers to the output in floating decimal (including single precision and double precision), and the output results occupy 8 grids, with 6 decimal places before the decimal point.

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