Printf (), scanf ()
% C --------------- output a character
% D ----------------- output a signed decimal integer
% E (% E) ------------ output a real number of floating-point numbers in the form of normalized exponent. Only 6 digits are valid.
Number, which includes one integer and five decimal places. The exponent part is connected to three digits in total)
% F (% F) ------------- outputs a floating point number. The default format will display 6 decimal places. For float type, valid numbers
Only the first 7 digits, double type, valid digits only the first 16 digits)
Eg: f = 1234567.1230; printf ("% f", & f); only the first seven digits of f = 1234567. xxxx are displayed, and the last digits are random.
% G (% G) ----------- output a floating point number, which can only display the first six valid values
% I ----------------- output a signed decimal integer
% O ---------------- output an octal unsigned integer must be positive or 0)
% P ---------------- output a pointer, that is, an address. The output value must be a pointer or address value)
% X (or % X) --------- output a hexadecimal unsigned integer must be positive or 0)
% S ----------------- output a string
% U ---------------- output an unsigned decimal integer
Additional format specifiers:
Space -------------- when the output value is positive, add a space before it. When the value is negative, add a negative number.
-****************** Align the output results left.
+ ****************** Add a symbol + or-to the output result -)
# **************** If the format is c, d, s, u, the output result is not affected.
* ************** If the format character is g, the decimal point is displayed only when the result contains decimal places.
* **************** If the format character is o, the o will be added before the output result
* *************** If the format character is x, the Ox will be added before the output result
The result of h **************** is output according to the short integer quantity.
L ****************** results will be output according to the Length Integer
Scanf () is used in the same format.
Different:
% [] ---------------- Scan Character Set combination during Input
M ----------------- specifies the width of the input data. m can only be a positive integer.
* ------------------ Indicates that the input will not be assigned to the corresponding variable.
This article is from the "java Notepad" blog, please be sure to keep this source http://6501542.blog.51cto.com/6491542/1287846