C language, I don t quite understand what it means, especially temp and output statements, ask for a

Updated on technology 2024-08-08
12 answers
  1. Anonymous users2024-02-15

    There is already something wrong with your program itself (the problem is that you don't give a, b, c initial values, and a third if, the logic is wrong. The next is that I corrected your program. Your program is to implement three inputs and then output from small to large.

    #include

    main()

    int a,b,c,temp;Four variables are defined here, a, b, c, temp

    printf("Please enter values for a, b, c:");

    scanf("%d%d%d",&a,&b,&c);Receive the input a, b, and c values.

    if(a>b) Note: temp is an intermediate variable, after this compound, b stores the maximum value between a and b, and a stores the minimum value between a and b.

    if(a>c) After this compound, c stores the maximum value between a and c, and a stores the minimum value between a and c.

    After the above two ifs, a becomes the smallest number of the three numbers in a, b, and c, and then compare b and c as follows to see who is bigger and who is smaller, the big one exists in c, and the small one exists in b, if(b>c) After this compound language, c stores the maximum value between b and c, and b stores the minimum value between b and c.

    After three ifs, he became an aprintf("%d<%d<%d",a,b,c);From small to large output.

  2. Anonymous users2024-02-14

    Here temp is used to store temporary variables, and the purpose is to exchange the values of two variables.

    Isn't this just comparing the size of ABC? Go get a book.

  3. Anonymous users2024-02-13

    temp is actually a temporary variable.

    It is equivalent to opening four spaces in the system and storing 3 values.

    temp (temporary, empty with no value) such as your above.

    if(a>b) is to assign the value in space A to the temporary temp, in this case the value in space A is empty, in the value of space B is assigned to space A, at this time the value in space B is empty, in the value of temp is assigned to space B.

    In fact, it is equivalent to exchanging A and B.

    Hope it helps.

  4. Anonymous users2024-02-12

    Temp is a temporary variable that is used to temporarily hold the minimum value.

    However, this statement is too inefficient.

    It is better to use the for statement to execute it.

    for(i=0;i<=3;i++)

    for(j=3;j<=i-1;j--)

    if(a[j]temp=a[j];

    a[j]=a[j-1];

    a[j-1]=temp;

    for(i=0;i<=3;i++)

    printf("%d",a[i]);

  5. Anonymous users2024-02-11

    if(a>b)

    If a is greater than b, swap the values of a and b

    if(a>c)

    If a is greater than c, swap the values of a, c

    if(b>c)

    If b is greater than c, swap the values of b, c

  6. Anonymous users2024-02-10

    temp is an empty variable, and your program does not input a specific value, it cannot be exchanged, it should be like this;

    #include

    main()

    int a,b,c,temp;

    scanf("%d%d%d",&a,&b,&c);

    if(a>b)

    if(a>c)

    if(a>b)

    printf("%d<%d<%d",a,b,c);

  7. Anonymous users2024-02-09

    You can buy this tutorial in C to see it.

  8. Anonymous users2024-02-08

    The temp in c is self-defined. It is often defined as a variable that plays a temporary role.

    It is an intermediate variable that interchanges the values of num1 and num2, first save the number of num1 to temp, and then assign the number of num2 to num1, so that the number of num1 will not be overwritten and disappear when num2 is assigned to num1, and finally the value of temp is assigned to num2 variable, so that the values of the two variables are exchanged very accurately.

    For example, if you have cup A and cup B, each filled with different solutions, and you now want to exchange the solution in cup A with the solution in cup B, you need an empty cup C to do the relay. And this empty cup is the big temp in your program.

  9. Anonymous users2024-02-07

    temp refers to the temporary folder, which is located in C: Documents and Settings Administrator Local Settings. A lot of temporary files are placed here, which are used for favorites, temporary files for browsing the web, files, etc.

    Temporary saving of files according to the process of operation.

    Our commonly used office software and other applications usually save the results of the user's work temporarily to prevent losses due to unexpected circumstances. Even if the user themselves does not save the file they are working on, many programs save text that has been deleted, moved, and copied by the user.

  10. Anonymous users2024-02-06

    temp is the name of a variable, which is the amount whose value can be changed with the name of an identifier.

    The variable temp plays the role of an intermediate exchange in this program.

    For example, when A and B are exchanged, the value of A is given to Temp, and then the value of B is assigned to A, and the value of Temp is the value of the original A.

  11. Anonymous users2024-02-05

    temp is a variable, its function is to be used as an intermediate variable for the exchange value of num1 and num2, first save the number of num1 into temp, and then assign the number of num2 to num1, so that the number of num1 will not be overwritten when num2 is assigned to num1 and make it disappear, and finally the value of temp is assigned to num2 variable, so that the value of the two variables is exchanged very accurately.

  12. Anonymous users2024-02-04

    What's C? Temp is what it means.

Related questions
8 answers2024-08-08

Combined Language is a computer programming language. It has the characteristics of both high-level language and assembly language. It can be used as a working system design language to write system applications, or as an application design language to write applications that do not rely on computer hardware.

15 answers2024-08-08

Indicates that the remainder of 6 is taken.

In the C language, % stands for remainder (or modulo operation). >>>More

25 answers2024-08-08

First of all, b++ means to do a self-additive operation on b, we use c instead, c=b++; >>>More

6 answers2024-08-08

1.Cold in the stomach.

The main evidence] The voice is slow and powerful, the stomach is uncomfortable, the heat decreases, the cold becomes worse, the mouth is neutral, the tongue is white, and the pulse is slow. >>>More

8 answers2024-08-08

2.Bitwise or arithmetic (|.))

Perform logic or operations on bits or bits corresponding to two computations, and the rules of operation are the same as those of logic or"||"Same. >>>More