-
Indicates that the remainder of 6 is taken.
In the C language, % stands for remainder (or modulo operation).
The format description consists of " " and format characters, such as d f, etc. What it does is to convert the output data into a specified format output. Formatting instructions always start with the " " character. Different types of data use different format characters.
Format characters include d, o, x, u, c, s, f, e, g, etc.
As. D integer output, ld long integer.
Output, o as an octal number and x as a hexadecimal number.
Output integer form, and unsigned data (unsigned number) as a decimal number.
c is used to output a character, and s is used to output a string.
f is used to output real numbers, which is output as decimals, e is used to output real numbers in exponential form, and g is automatically selected in f format or e format according to size, and does not output meaningless zeros.
scanf (control character, address list).
The meaning of the format character is the same as the printf function, and the address list is a table column composed of several addresses, which can be the address of a variable or the first address of a string. Such as scanf("%d%c%s",&a,&b,str);
-
The overall length of the number, including the decimal point, is 6 digits.
floata
printf(
What will the screen output?
The meaning of the format is that the overall length of the number including the decimal point is 6 decimal places, and two decimal places are retained. But when the actual length is greater than the number of digits defined in the format, the actual will prevail, so the output is.
The second is to fill in the blanks when the number of bits defined by the format is greater than the actual length.
The output is:
Indicates a space.
-
1e-6 represents 1 times 10 to the minus 6 power.
1e-6 is actually equivalent to x==0
1e-6 (also known as epslon, is used to counteract the undecidable situation caused by the error of the scumbag in floating-point arithmetic. It's usually a very small number (how small it is depends on your arithmetic error).
For example, because of the accuracy error, using decimal system as an example, we need to calculate 1 3+1 3+1 3==1 (mathematically speaking, it must be equal), but because of the accuracy problem, the left side of the equal sign is calculated as an error, and the right side is, then if we directly use == and return false, we want it to be regarded as equal. Then it is necessary to subtract the two numbers to find the method of the absolute value less than epslon.
Returns the absolute value of the parameter. Parameters can be of int, float, long, double, short, and byte types.
Grammar. The format of each type of method is similar to the following:
double abs(double d)
float abs(float f)
int abs(int i)
long abs(long lng)
Parameter. Any native data type.
Return value. Returns the absolute value of the parameter.
Instance. public class test{
public static void main(string args)
integer a=-8;
double d=-100;
float f=-90;
;Compile the above program, and the output result is:
-
In the C language, %6d:6 indicates that the width of the specified output field is 6. If the number of digits of the data is less than 6, the left end is filled with a space, and if it is greater than 6, it is output according to the actual number of digits. This is mainly for right-aligned formatted output.
The syntax constraints of the C language are not too strict, the type constraints on variables are not strict, which affects the security of the program, and the array subscripts are not checked for out-of-bounds. From an application perspective, C is more difficult to master than other high-level languages. In other words, for those who use the C language, they are required to be more proficient in programming.
-
If there is one after %." * ", which is an additional specifier that indicates the number of columns it specifies when read is skipped. For example: %6d%4d%2d%2d means that a 6-bit integer is read but no value is assigned to any variable.
Then read in 4 integers, 2 integers, 2 integers, and finally end the reading. Seek adoption.
-
What does (c& (3<<6) mean in the C language?
Dear, I'm glad to answer for you: C (C& (3<<6) is like this: this is the left shift of the displacement operation in C.
For example, for 3, its binary is 0011, (3 <<1) means that the binary of 3 is shifted to the left and limb by 1 bit, which becomes 0110, i.e., 6;(3 <<2) means that the binary of 3 is shifted 1 place to the left, and it becomes 1100, which is 12. Therefore, it can also be seen that shifting 1 bit left is multiplying 2 on the basis of operands, and shifting n bits left is multiplying by 2 n. Brotherhood.
-
11&&6 in C means 11&&6=1, and both numbers are slippery and not 0.
It is used in C to mean conditional and/and/and, and is usually used in conditional expressions. Faith Sun Song.
-
1e alone is illegal.
And other combinations have several uses.
1 and 0x combinations. 0x1e represents a 16-decimal integer.
2 is followed by an integer. Like 1e-5 1e10 and so on. Floating-point numbers expressed by scientific notation. double type.
3 strings"1e"It's just a simple string.
4 Character escape'\x1e'Indicates the character corresponding to the ASCII code whose value is 0x1e. Can also be used for strings such as:
ab\x1ecd"Here are five characters, and plus the ending character, that's six.
There are only a few that come to mind, and I may not be able to do all of them.
-
A floating-point number expressed in scientific notation.
The generic form is AEB
where a can be any real number. e can be written as e. b must be an integer.
Represents a times 10 to the power of b.
1e-6 is 1 times 10 to the power of -6, that is.
Since the float significant bits are 6 or 7 bits, 1e-6 is often used as a precision value for float type operations.
-
1e-6 represents floating-point numbers. That is, 1*10 to the 6th power.
I suggest you take a look at Introduction to Strings.
-
It means 1 point 0 times 10 to the minus 6 power.
-
That's what it means.
1e-1 is a representation of a floating-point number, which actually is.
-
The rules of the above trinocular conditional operation are: first calculate the value of the expression x, if x is true, then the result of the whole trinocular operation is the value of the expression y; int max=a>b?a:b;
-
It is also an operation in a bitwise operation, and the operation rules of the left-shift operation in a bitwise operation are as follows:
The binary representation of 3 is 011, and the binary representation of 6 is 110, so the result obtained later is 101, which is 5 in decimal
5<<2 gives 10100, which is 20 in decimal
After that, the low position is zeroed.
-
is 4, & is the meaning of digit and, |It means by bit or.
The calculation rule is as follows: 1&1 = 1.
The calculation rules are as follows: 1|1 = 1|0 = 0|1 = 1。
The binary representation of 5 is 101, and the binary bit of 6 is 110.
So 5&6=(100) decimal is 4.
C Language Features:
Simple, compact, flexible and convenient. There are only 32 keywords in the C language, 9 kinds of control statements, the program is written freely, and the main posture is represented by lowercase letters.
It combines the basic structure and sentences of a high-level language with the practicality of a low-level language. The C language can manipulate bits, bytes, and addresses in the same way as assembly language, which are the most basic units of work of a computer.
The operators are abundant, and the range of the C operators is very wide, with a total of 34 operators. C and Lu Yan treat parentheses, assignments, and forced type conversions as operators.
As a result, the operation types of C are extremely rich, and the types of expressions are diversified, and various operators can be used flexibly to achieve operations that are difficult to achieve in other high-level languages.
This is an additive function I wrote that can judge overflow: >>>More
Valid variable names for the C language:
First, it can only contain numbers, letters, and underscores. >>>More
The semicolon is the sign of the end of the statement, but the semicolon is not used after the loop, if, and subfunctions such as long long a (int b), and everything else is used, but two semicolons cannot be added, although it will not cause an error, but it may affect the result.
Understand the following rules: 1) Overloading an operator does not change the priority of the operator. >>>More
srand(int) is used to set the seed, and then returns a random value each time rand(). >>>More