How do you learn C? Master, please explain

Updated on culture 2024-02-09
6 answers
  1. Anonymous users2024-02-05

    C language is the language of writing system software, application software, such as Windows and DOS, are written in C language. Writing a program in C requires the compiler to convert the C format language into machine instructions, so that it can control the operation of the computer. Tuborc is the C environment under the DOC, VC, Brolandc is the C environment under the Windows environment.

  2. Anonymous users2024-02-04

    Look more, listen more, knock more, don't do it behind closed doors.

  3. Anonymous users2024-02-03

    Read more, write more, there is no other way!

  4. Anonymous users2024-02-02

    Read a book, look at some simple programs.

  5. Anonymous users2024-02-01

    This is due to floating-point errors. The root cause of this is that the binary 01** used by computers does not accurately represent some decimal data with decimal places. We know that converting a decimal value to a binary value requires the following calculation:

    1.Integer part: Divide the integer by 2 continuously, take the remainder, and then divide the quotient by 2 again until the quotient is equal to 0. Then put the resulting remainders in reverse order. Abbreviation"Divide by 2 remainder method"。

    2.Decimal part: Convert decimal decimal to binary decimal number, adopted"Multiply by 2 and round up, in order"Law.

    Multiply 2 by decimal decimal to take out the resulting integer part, multiply 2 by the remaining decimal part, and then take out the integer part of the product until the decimal part of the product is 0 or the required accuracy is reached. Then the integer parts taken out are arranged in order, that is, the integer part taken out first is used as the high position of the binary decimal place, and the integer part taken out later is taken as the low significant bit. Abbreviation"Multiply by 2 to round it integer"。

    3.Decimal numbers containing decimals are converted to binary, integers and decimal parts are converted separately, and then added.

    This leads to an obvious problem: there are decimal numbers that cannot be converted to finite binary numbers:

    The ellipsis at the end indicates that the calculation is exhausted, and the binary value of 0011 is repeated indefinitely.

    Currently, floating-point values are stored on computers in accordance with the IEEE (Institute of Electrical and Electronics Engineers) 754 floating-point memory format standard.

    The IEEE single-precision floating-point format has a total of 32 bits and contains three constituent fields: 23 decimal places f, 8 bits bias exponent e, and 1 sign s. These fields are stored in a continuous 32-bit word and encoded.

    where 0:22 contains 23 decimal places; 23:30 contains 8 digits of exponent e; The 31st bit contains the symbol s.

    As shown in the figure below:

    That is to say, we can only store 23 bits in the binary ** that we convert above, and only 52 bits can be stored even if the data type is double, so that you can see the cause of the problem.

    It's a pity that we can't solve the problem at the root, unless you can invent the decimal computer, but we can save the country with a curve:

    Because binary values can accurately represent integers (which can be verified using integer to binary methods), you can multiply decimal numbers by 10 or 100 and so on to become an integer, then do integer operations, and finally divide by 10 or 100 to get the result;

    2.The best approximation of the result is obtained by intercepting the number of significant decimal places, etc., and then processing it.

    3.For decimal values that can be represented by binary values of finite length, you can use a data type that stores bits greater than its length.

    Refer to CNSD

  6. Anonymous users2024-01-31

    With %2f can achieve a situation where the output is reserved for two bits.

    But the actual value of f remains unchanged.

    The practical significance of this operation is, first, to understand and use rounding.

    Second, keep the actual value of i to two decimal places, so that it can be used for later calculations. Of course, for the current program, if you don't use i calculations in the future, it makes no difference.

Related questions
4 answers2024-02-09

2. 1, True 2, False (there is only one program) 3, False (not necessarily) 4, True. >>>More

9 answers2024-02-09

Scope. You static char *chh;

static char *ch1;Although the address pointed to by the two pointers does not change, have you ever wondered whether the memory address they point to has been released, char chc[10]; It's local, the function is out, the lifecycle is over, and you're trying to access it with a pointer in void times(). >>>More

10 answers2024-02-09

main() [main function main program].

int i,j,k;【Define integer data i,j,k】for(i=1; i<=6;i++) main loop, i from 1 to 6, increasing to 1] for(j=1; j<=20-2*i;j++) subcycle, j from 1 to 20-2*i >>>More

15 answers2024-02-09

C++ is an object-oriented language, not very easy to learn, because it is more flexible, so there are a lot of problems to consider when doing programs! Because of the direct operation of the hardware, it inherits the advantages of the C language, so it is very efficient, and is generally used for the underlying and embedded systems.

8 answers2024-02-09

You have to look at **", not memorize**, but you also have to learn the basics of the C language. If you don't even know ABCD, how can you read English**? Reading more about what others write is something you do after you have a certain foundation. >>>More