The basic result control of language---loop

When writing a program, all that is encountered is the sequence structure, the selection structure, and the loop structure. No matter which language will have these three structures, it is also said that recursion is essentially a loop.

The order structure and the selection structure are not to be mentioned.
The key is the loop structure: c/c++, java will have three basic loops for, while, do-while


do-while structure diagram
do-while structure
eg:

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main() {
    int i = 0;
    do {        
        printf("####\n");               
    }while(i++ < 3);
    return 0;
}

result

In fact, the most basic of the program is the three basic logic controls. When writing the program, it is do-while(); I don’t understand it. Every time I go to the while to judge, I get stuck. I will make a note here.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325863709&siteId=291194637