Hi. Newbie question again
I have this code that randoms out 4 names on the screen and I want to save the words that are randomed out on the screen in a variable (maybe with an array?).
this is the code:
I want to save the c[j] in a variable so I have all four randomed names in one variable (array?).Code:char c[4][6] = {"Tony","James","Johnny","Lars"}; srand((unsigned)time(NULL)); for (i=0;i<4;i++){ j = rand() % 4; cout<<c[j]<<"\n"; // code for saving c[j] names in a variable }
How do I do this?





Reply With Quote