Hello and Happy New Year,
I would like to loop through a list of names infinitely like this:
Harry
Dick
Tom
===
Dick
Tom
Harry
===
Tom
Dick
Harry
etc...
I have this for the moment:
Code:#include <iostream> using namespace std; int main() { int i = 0, j = 0; char * Names[] = { "Harry ", "Dick", "Tom", }; int iSize = (sizeof(Names)/sizeof(Names[0])); while(1) { for(; i<=iSize; i++) { if(j >= iSize) j = 0; cout << Names[j++] << endl; } cout << endl; if(j == iSize) j = 1; } return 0; }