Home > Back-end >  Don't understand the language c cycle
Don't understand the language c cycle

Time:10-13

To begin with C language, but also understand the point, now learn C language circulation structure, make me confused, how can good intention person to help me learn and grasp well, thank you.

CodePudding user response:

Stick to write the code examples, indicate which statements do not understand

CodePudding user response:

Try themselves according to the book code, good ask ten questions.

CodePudding user response:

Serious agree with upstairs.

CodePudding user response:

Alas, poor child, I help you, incomplete in each supplement:

 
A, unconditional to statements: goto statement label;//statement label the first character must be a letter or an underscore, and not for the digital,

Second, while statement:

Format:

int i=0;
While (i<=10) {//loop condition
Application - & gt; ProcessMessages ();//in the long time cycle response message
//loop condition established execution code:
i++;//equivalent to I=I + 1;
}

Format:

int i=0;
Do {
Application - & gt; ProcessMessages ();//in the long time cycle response message
//loop condition established execution code:
i++;//equivalent to I=I + 1;
} while (I & lt;=10);//loop condition

Three, for statement:

AnsiString ch [40].
Int I=0, a=ListBox1 - & gt; The Count.
for (i=0; I & lt;=a - 1; I++)
Ch [I]=ListBox1 - & gt; The Items - & gt; Strings [I];
Or:
For (; ; {//terminate the circulation
Application - & gt; ProcessMessages ();//to be in the long time cycle response message
//execution statement
}
Or:
AnsiString ch [40].
Int I=0, a=ListBox1 - & gt; The Count.
For (; I & lt;=a - 1; ) {
Ch [I]=ListBox1 - & gt; The Items - & gt; Strings [I];
i++;
}
Or:
for(int i=0; i<10; I++) {//cycle
Application - & gt; ProcessMessages ();//to be in the long time cycle response message
//execution statement
Sleep(10);//delay 10 milliseconds
}

Jump out of the loop:

break;//end of the cycle

End of the cycle:

continue;//jump over the cycle has not yet been performed below statement, then perform the next cycle

To loop response message for a long time, can be added in the loop:

Application - & gt; ProcessMessages ();//in the long time cycle response message

//an example special usage:


Void __fastcall TForm1: : Button1Click (TObject * Sender)
{
Int z=0;
int i=0;
For (I=0, z=1; i<10, z<5; I++ z++) {//loop can be comma separated condition
}
Edit1 - & gt; Text=I;
Edit2 - & gt; Text=z;
}


CodePudding user response:

Also don't understand the words LZ is the correct attitude 'assiduous research

CodePudding user response:

The original poster is probably the lack of a system of knowledge, is still in the "twilight" period of learning new knowledge, across the heart of the go to the white background

CodePudding user response:

On the top floor

CodePudding user response:

Poor child, a good thank "cautious"

CodePudding user response:

Examples of good upstairs
  • Related