C++ for each loop iterates through each member of array

Description

C++ for each loop iterates through each member of array

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    cout << "The primes less than 20 are:" << endl;
    for(int n : {1, 2, 3, 5, 7, 11, 13, 17, 19})
    {//from  w  ww  .ja va 2  s.c o m
        cout << n << ", ";
    }
    cout << endl;

    return 0;
}



PreviousNext

Related