Detailed explanation of the selection structure and loop structure of C++ program
This article mainly introduces the "detailed explanation of the selection structure and loop structure of the C++ program". In the daily operation, I believe that many people have doubts about the choice structure and loop structure of the C++ program. The editor consulted all kinds of materials and sorted out the simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about the "detailed explanation of the selection structure and loop structure of the C++ program". Next, please follow the editor to study!
Catalogue
1. Select structure
1.1 judgment statement if
1. One-line if statement if
two。 Multiline if statement if...else
3. Multi-conditional if statement if...else if...else if...else
4. Nested if statement
1.2 trinomial operator judgment
1.3 switch statement switch
two。 Cyclic structure
2.1 while
2.2 do...while
2.3 for
2.4 cycle control
1.break: jump out of the cycle
2.continu: jump out of this cycle and move on to the next cycle
3.goto: jump to label and then go down
2.5 cycle nesting
1. Select the structure 1. 1 judgment statement if1. Single-line if statement if#includeusing namespace std;int main () {/ / Select statement if statement / / user input score, if the score is greater than 600, it is considered to be admitted to the examination, output / / 1 on the screen, user input score int score = 0; cout