Level 2 C problem, Level 2 C language minor problem

Updated on educate 2024-02-08
16 answers
  1. Anonymous users2024-02-05

    The output of this program is: 4

    You can standardize the program to make it easier to understand.

    #include

    main()

    int a=1,b=2,c=3,d=0;

    if(a==1) if a==1 is executed.

    if(b!=2) If b!=2 execution.

    if(c==3) d=1;If a=1,b!=2, c=3, then d=1;

    else d=2;If a=1,b!=2, c=3, then d=2;

    else if b=2.

    if(c!=3) d=3;If a=1, b=2, c!=3, then d=3;

    else d=4;If a=1, b=2, c=3, then d=4;

    else d=5;//a!=1, then d=5;

    printf("%d",d);Output d

  2. Anonymous users2024-02-04

    The result is 4 if-else indents it with full curly braces and you'll get the idea.

    #include

    main()

    int a=1,b=2,c=3,d=0;

    if(a==1)

    if(b!=2)

    if(c==3)

    d=1;else

    d=2;else if(c!=3)

    d=3;else

    d=4;else

    d=5;printf("%d",d);

  3. Anonymous users2024-02-03

    Note: When writing **, you must be standardized, meet if....and so on, be sure to add {}, otherwise there will be problems and the readability of the program will be poor.

    I changed your program, and the writing specification was a little bit, and it was fine, and the output result was 4 include

    int main()

    int a=1,b=2,c=3,d=0;

    if(a==1) Note the addition of {}, so that it is easy to see which else if or else matches.

    if(b!=2)

    if(c==3)

    d=1;else d=2;

    else if(c!=3)

    d=3;else d=4;

    else d=5;

    printf("%d",d);

    return 0;

  4. Anonymous users2024-02-02

    #include

    main()

    int a=1,b=2,c=3,d=0;

    if(a==1) condition is true.

    if(b!=2) The condition is not true.

    The following statements are not executed.

    if(c==3)

    d=1;else

    d=2;else if(c!=3)

    d=3;The above statements are not executed.

    If the condition of the if statement corresponding to else is not valid, elsed=4 is executed. If the if condition is true, the else statement is not executed.

    d=5;printf("%d",d);The end result is d=4

  5. Anonymous users2024-02-01

    That is true! C++ languages are more difficult than VB and VFP, so be prepared!

    1. Written test:

    a. Buy a thick book, a book with both explanations and exercises, which is a thematic explanation. This is a good grasp of each unit! (Go to your bookstore and pick one).

    b. After that, buy this exercise book, the type of test paper, do more summary.

    2. On the machine:

    Buy this question bank collection (such as the Golden Edition Electronic Publishing House), memorize it and practice on the computer! If the written test is ready, the questions on the computer are easy to understand and easy to memorize!

    This is the safest thing to do, and I wish you a speedy pass!

    C++Primer is one of the most classic C++ textbooks, and it is more classic than Thinking in C++. Even the author himself says that he wrote this book to give readers a better understanding of C++. However, my experience of reading books is that C++Primer is easier to write than Thinking in C++.

    If you are a beginner in C++, C++Primer Plus 5th is more suitable than Thinking in C++, and you only need to see the chapter of the class, and then start to read the two volumes of Thinking in C.

  6. Anonymous users2024-01-31

    There are question banks and mock questions, and it's best to sign up for a class to learn it, it's too tiring to watch it yourself.

  7. Anonymous users2024-01-30

    Buy a designated tutorial textbook, and the computer grade test is basically enough to look at the tutorial textbook.

  8. Anonymous users2024-01-29

    Tan Haoqiang's C language 4 is a very good book, it is recommended to read it will be rewarding.

  9. Anonymous users2024-01-28

    The assignment operator is operated from right to left, so a is wrong in assigning a value to the constant 1, which is 1=......The assignment operation in this step is incorrect. There are two operators in c parentheses, the double equals sign == is a logical operator, a decision operation, and then an assignment operation, no problem. In a, b=1 is changed to b==1 and it is still wrong, because there is an assignment operation to the right of the parentheses, (b==1)=1, then the assignment operation on the right has also become an assignment to a constant, which is another error.

    There is a static keyword before the definition of s, which indicates that it is a static variable, and the static variable will open up a separate address in memory, and will not be released after the function is executed, so the result can be accumulated.

  10. Anonymous users2024-01-27

    Option A is wrong not in the parentheses, but in the 1=, = outside the parentheses, which is to assign a value to the variable, == is to compare whether it is equal, and to assign a value to the number, it must be wrong.

    static is a static variable that can be used as a global variable with a fixed scope.

  11. Anonymous users2024-01-26

    1. One equal sign is assigned, and two equal signs are equal!

    The third option, b=c==9, is now assigned as c==9 and c==9 is of the bool type, so option c is wrong.

    2. The static variables defined in the method body are initialized, and the initialization operation will not be performed again (only executed on the first call).

  12. Anonymous users2024-01-25

    Hello!!!

    About item a: If the previous definition is like this: int a=1; then a=a+7; Exactly right, but if the definition is; const int a=1;Then it's wrong, for the simple reason that since a is a constant when it is declared, its value should not change.

    So a=a+7; is wrong.

    With regard to item b, Ibid.

    Item c; The operand about the remainder operator must be an integer, a floating-point number d term, a constant variable or an expression can not be used as an lvalue, a+7 is an expression that we don't understand and then contact!!

  13. Anonymous users2024-01-24

    Option a: One more"; The semicolon is a statement, not an expression.

    Option C: The operation can only be an integer participating in the operation. Floating-point models cannot participate in calculations.

    Option d: C+B cannot be assigned to A+7, which means that the lvalue (A+7) is invalid.

  14. Anonymous users2024-01-23

    A is not an expression, it is a statement.

    c does not conform to grammar; If the cast conversion to an integer should be: (int), the operation can only be an integer.

    d is a continuous assignment, where a+7=c+b does not conform to the syntax of the c language, only variables can be assigned, and a+7 is obviously not a variable.

  15. Anonymous users2024-01-22

    The last two questions are the data structures, "Look at the book."

    1. x=3,5,7……

    x%2=1 So select d d term expression error false returns a value of 0 note b he is a declarative sentence.

    Regardless of the value of x, the value of the expression is true, and 12A queue is a linear structure, like a chain, that links elements together in a line, and a nonlinear structure has.

    Collections (scattered, with no connection between elements).

    tree (divergent, one-to-many, obviously nonlinear).

    Figure (looks messy, many-to-many).

    It can be understood that being a map linear is one-to-one.

    3.The memory storage method of the sequential storage structure is that the physical location is separated, as long as the starting position is determined, the element can be read and written arbitrarily, and the linked list is different, it can be vividly considered that it is a chain strung together by a pointer, and there is no connection between the physical position in memory, only a logical connection, and the operation on the linked list can only be slid down along the pointer to find the location of the operation.

  16. Anonymous users2024-01-21

    1.The value is 0, sometimes it can be false, only d, x%2 must be 1 instead of 0

    2.Linear structure refers to the representation that logically can be visualized by the concept of line. A queue with a chain is like a knot.

    3.Refer to the second question, compare the two structures of the linear table, and understand it yourself.

Related questions
4 answers2024-02-08

I heard the teacher say that the second level of computer science seems to focus on C language programming, and it is difficult to learn by myself, and I don't understand what the teacher says, maybe it's my IQ problem.

18 answers2024-02-08

1. What are the influences of natural conditions on road design, and how do you consider them in your design? >>>More

21 answers2024-02-08

Computer level 2 is divided into VF and C language, C language is said to be not suitable for science students to learn, VF is the choice of most liberal arts students, but the specific also varies from person to person, these two certificates are finally national level 2 certificates. For accounting majors, it is best to take the C language. As for self-study or training, depending on your computer foundation, I personally think you can decide to learn C language or VF, and then buy your own textbooks, our textbooks are very detailed, and ordinary people can understand them, and then ** software is ok··· It mainly depends on how your computer foundation is, and whether you can understand it by self-study... I don't know if I can help you...

5 answers2024-02-08

The following conditions are required to apply for intelligent second-level qualification: >>>More

16 answers2024-02-08

There is no textbook for 2011, there is a full set of textbooks for 2010, and there is also a full set of training courseware for 2010. Since there are about 100 files of the courseware, roughly 3G files, it cannot be sent to your mailbox one by one, you can only send **link, yourself**. >>>More