What is the role of do in C? What does DO mean in C?

Updated on technology 2024-02-09
7 answers
  1. Anonymous users2024-02-06

    do is used to loop.

    For example. int i=1,sum=0;

    do{sum=sum+i;

    i=i+1;

    while(i<=10)

    1+2+...10, the do-while loop can be replaced by a for loop, etc., and there is no situation where you can't run without do.

  2. Anonymous users2024-02-05

    do is used in conjunction with while, in C++ do....The while loop statement is formatted as follows:

    DO Loop Body.

    while( condition).

    do represents the beginning of the loop, while indicates the end of the loop, if the program executes to while, when the condition in while is true, it will continue to run from the do start loop, if it is false, it will jump out of the loop.

    Run the while statement.

  3. Anonymous users2024-02-04

    In the C language, do means to execute a ** block, and the do keyword cannot be used alone, but is usually used in do....while loop.

    do…While loops are not used often and are primarily used for human-computer interaction. Its format is:

    dowhile (expression);

    Note that the semicolon after while should never be omitted.

    do…The execution process of while and while is very similar, with the only difference being: "do....while is to execute the loop body once and then discriminate the expression". When the expression is true, return to re-execute the loop body, and so on until the expression is false, at which point the loop ends.

    In many practical problems, there are many regular repetitive operations, so it is necessary to repeat certain statements in the program. A set of statements that are repeatedly executed is called a loop body, and whether it can continue to be repeated determines the termination condition of the loop.

    The cyclic structure is a process structure in which a certain section of a program is repeatedly executed under certain conditions, and the program that is repeatedly executed is called a cyclic body. A loop statement consists of two parts: the loop body and the end condition of the loop.

    for is a loop statement, which well embodies the three problems that should be paid attention to in the correct expression of the loop structure

    Initialization of control variables.

    The condition of the cycle.

    Cycle control the update of variables.

    for expression.

    Expression 1: It is generally an assignment expression that assigns an initial value to the control variable;

    Expression 2: relational expression or logical expression, loop control condition;

    Expression 3: Generally an assignment expression, which increases or decreases the amount of the control variable.

    Statements: Loops, compound statements must be used when there are multiple statements.

  4. Anonymous users2024-02-03

    The keyword do in computer C cannot be used alone, but must be used in conjunction with while.

    There are three loop formats in the C language: for(), while(), and do.while();

    1. The format of the while loop is:

    while( e )

    The meaning is: first check whether the loop condition e is true, if e is true, then execute the while statements in the loop body; statement, otherwise, end the while loop. It can be seen that when e is false for the first time, the number of while loops will be 0, i.e.,

    In this way, the minimum number of executions is 0

    2、do..The while loop is in the format:

    do while( e );Note that there is no shortage of semicolons here!

    The meaning is to execute the do while statements in the loop first

    statement, and then determine whether e is false, if false, end the while loop, and if true, continue the loop. It can be seen that when e is false for the first time, the number of do while loops will be 1

    times, i.e., the minimum number of executions in this way is 1Or at least once.

  5. Anonymous users2024-02-02

    do while loop statement, whether true or false, must be executed once.

  6. Anonymous users2024-02-01

    The most - bento - should be empty shirt - of the guitar - him.

    Natural major scale.

    Sound name: c d e f g a b c

    Roll call: do re mi fa sol la si do Score: 1 2 3 4 5 6 7 1

    Whole tone Whole tone Semitone Whole tone Whole tone Whole tone Whole tone Tone

    It is inferred according to the law of reserve for loss

    The do in the key of C is C

    And the do in the key of D is D

    The D scale is arranged as if it was delayed.

    d e #f g a b #c d

    It is arranged according to the way of all-all-half-all-all-half, that is, 2212221

    Hope!!!

  7. Anonymous users2024-01-31

    In the C language, do means to execute a ** block, and the do keyword cannot be used alone, but is usually used in do....while

    Looping. At.

    c, do....The while loop is the condition for checking it at the tail of the loop, do....while loop.

    while loop, but.

    do...while

    Loops ensure that the loop is executed at least once.

    Unlike for and while loops, they test the loop condition at the loop head. do……While its ante rock syntax format is as follows:

    do{statement(s);

    while(

    condition

    Extended Materials. In the do ......While conditional expressions appear at the end of the loop, so in the loop.

    statement(s)

    It will be executed at least once before the condition is tested.

    If the condition is true, the control flow jumps back to the above.

    do, and then re-execute the .

    statement(s)。This process is repeated until the given condition becomes false.

    Example: include

    intmain

    intadoprintf("a

    Value: d",a);aa

    while(a

    return

    When running the program, the result of the input is the value of a

    The value of a: the value of a:

    The value of a: the value of a:

    The value of a: the value of a:

    The value of a: the value of a:

    The value of a:

Related questions
6 answers2024-02-09

Understand the following rules: 1) Overloading an operator does not change the priority of the operator. >>>More

14 answers2024-02-09

My theme,Very good mobile phone**,Theme、Flash、Games are available。 After entering the homepage, select the phone model, and then search for Dota is the link above. But it seems that this model is very unpopular now, and Dota is not as popular as Warcraft, so there are relatively few resources to search, hehe. >>>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

7 answers2024-02-09

A local variable (an internal variable) is defined inside a function, and its scope is limited to the variable inside the function that defines it. >>>More

5 answers2024-02-09

These are not macro definitions, these are file containments. >>>More