c++ for i in code example
Example 1: range based for loop c++
array<int, 5> values = {1, 2, 3, 4, 10};
// the type declaration below must be consistent with the array type
for (int x : values){ //we use a colon instead of in
cout << x << endl;
}
Example 2: c++ for loops
#include <iostream>
#define FOR(i,a) for (int i = 0; i < a; i++)
FOR(i, 3) cout << i << endl;