Storing data from a loop to a array?
Code:
int getcard()
{
srand((unsigned)time(0));
int x;
string mix[10];
string h;
do
{
for(int index= 0; index<10; index++)
{
x= rand() % 18;
h = master[x];
cout << h << endl;
}
mix[10] = h;
}
while (false);
return 0;
Hi, i'm new to c++ and my question is how do i store data from a loop cycle into a array, then print it?
Do i need to make another loop? if so how do i go about that? also if what i ask is possible, when every time i re-run the compiler will the array above get re-written or erased(hope it does)?
basic as possible please if not please explain thank you