(5)C++ 循环

   

一、for循环

    for (int i = 0; i < 5; i++)
    {
        cout << "abc"<< endl;
    }

    for (int i = 5; i; i--)
    {
        cout << "abc" << endl;
    }

二、while循环

    int a = 0;
    while (a<10)
    {
        a++;
        cout << a << endl;
    }

三、do while循环

    int a = 0;
    do
    {
        a++;
        cout << a << endl;
    } while (a<5);

四、基于范围 for循环

五、循环和输入

六、嵌套循环和二维数组

扫描二维码关注公众号,回复: 7284909 查看本文章

猜你喜欢

转载自www.cnblogs.com/buchizaodian/p/11521087.html