#include <iostream> #include <vector> using namespace std; std::vector<int> myvect {1, 2, 3, 4}; int main() { int breakCount = 20; int counter = 0; for( auto it = myvect.begin(); ; ++it ){ if( it == myvect.end() ) it = myvect.begin(); cout << *it; if(++counter == breakCount) break; cout << ", "; } return 0; }
Standard input is empty