Thank you, yes, its permutation what I was looking for, with permutation it is much simple.
I managed to do it with for loop after all.
Code:
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
int j = 0, iCounter = 0;
char * Names[] =
{
"Harry ", "Dick", "Tom",
};
int iSize = (sizeof(Names)/sizeof(Names[0]));
int global = iSize+3;
while(global--) // just for test purpose, to avoid going on forever
{
for(int i=0; i<iSize; i++)
{
if(j == iSize) j = 0;
cout << Names[j++] << endl;
}
cout << " = = = " << endl;
if(iCounter == (iSize-1))
{
j = 0;
iCounter = -1;
}
else if((iCounter < iSize))
{
j = iCounter + 1;
}
iCounter++;
}
return 0;
}