C++ examples for Statement:for
For each loop iterates through each member of a list
#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}) {//www . ja v a2 s . c o m cout << n << ", "; } cout << endl; return 0; }