032.程序流程结构-循环结构-do-while语句

#include <iostream>
using namespace std;
int main()
{
    //do...while语句
    //在屏幕中输出0到9这10个数字
    int num = 0;
    do
    {
        cout << num << endl;
        num++;
    } while (num < 10);

    //do...while和while循环区别,do...while会先执行一次循环语句,while条件为0不执行
    system("pause");
    return 0;
}

 

posted @ 2021-09-04 08:46  梦之心  阅读(33)  评论(0编辑  收藏  举报