Loops in C++

#include <iostream>
using namespace std;

int main() {
    int v[] = {0,1,2,3,4};
    for(auto x : v)
    {
        cout << x << endl;
    }

    for(auto y : {10, 20, 30})
    {
        cout << y << endl;
    }
    
    return 0;
}

输出:

0
1
2
3
4
10
20
30

posted @ 2023-03-23 23:04  SpacetimeCoding  阅读(44)  评论(0)    收藏  举报