What does "%2c" mean in C language output? Printf is the output, scanf is the input, and %2c inputs or outputs characters with a width of 2. In the printf function, if more than 2 characters are output, the original characters will be followed; If it is less than 2 characters, spaces will be filled.
What is the meaning of% in printf output by C language? Format flag in format parameter when printing format.
The parameter of %d integer is converted to a signed decimal number.
The parameter of %u integer is converted to unsigned decimal number.
The parameter of %o integer will be converted to unsigned octal number.
The parameter of %x integer is converted to unsigned hexadecimal number and expressed in lowercase abcdef.
The parameter of %X integer is converted to unsigned hexadecimal number, and expressed in uppercase ABCDEF.
Parameters of type %f double will be converted into decimal numbers and rounded to six decimal places.
Parameters of type %e double are printed in exponential form, with a number before the decimal point and six numbers after the decimal point, and the exponential part is represented by lowercase e.
The function of %E is the same as that of %e, the only difference is that the exponent part will be represented by the capital letter e.
Parameters of type %g double will be automatically printed in the format of %f or %e, and the standard will be determined according to the printed value and the set number of significant digits.
%G has the same function as %g, the only difference is that %E format will be selected when printing in exponential form.
Parameters of %c integer will be converted into unsigned characters and printed.
%s parameters pointing to a string are output word for word until a null character appears.
%p If the parameter is a pointer of type "void *", it will be displayed in hexadecimal format.
C language output x=%7.4f What does it mean to output floating-point numbers? The format is, a * * * has 7 digits, including 4 decimal places.
What does %*d mean in C language output printf? In printf, it can be understood that * is replaced by printf ("%*d", number, var); , and then press printf ("%NUMBER d"10); To print the information in the format and look at the code:
# include & ltstdio.h & gt
void main()
{
printf(" 000000 123450000000 \ n ");
printf(" 1=%d,2=%*d,3=%d\n ", 1,5,3,3);
Return;
}
printf("%*d ",a,b); Where A is the output width control of B, which is actually the replacement function of *. It is precisely because the replacement function of * is combined with the width control of %md that the rules of how to output after replacement are the same as the width control. Such as printf("%*d ",2,123); The output is: 123, which is equivalent to the effect of %2d output. Because the number of digits of 123 exceeds 2, it is output as it is, which is preset right alignment. printf("%*2d ", 1, 123); Output should be [9 spaces ][ 123], which is equivalent to% 12d output.
What does the java language mean? Java language is a simple, cross-platform, object-oriented, decentralized, explanatory, robust and safe, structure-neutral, portable, multi-threaded and dynamic language with excellent performance.
The diamond output by C language is a line number, which may mean printing several lines of words, arranging them according to the diamond shape, and using the line number as the character of the line. For example:
White 1
Bai 222
33333
Bai 444
White 5
In order to stand out, I write white to represent spaces.
It is also possible that the whole diamond is filled with a number, for example, there are five rows of diamonds on it, all of which are 5.
What does the C language output format %.45g mean? % .45g The 45 here looks a bit strange. Theoretically, for G format, this number means "This is the maximum number of significant digits to be printed".
There are actually 45 numbers here. In fact, the most significant digit of a double-precision floating-point number is 14. The compiler will ignore the requirement of.45.
% g is an ellipsis format for floating-point numbers. It automatically determines whether to output in %e or %f format. The criterion is: which is short and which is short. In addition, when printing, it omits the extra 0 after the decimal part. For example 1.23000, the output is 1.23.