S
syntheticdesigner
I hope someone could correct this simple excerpt
since I fail to see how I can make rand() function works
in a loop manner
/////////////////////////////////
srand(time(NULL));
int r1=rand()%10+1;
for(int o=0;o<r1;++o){
int r2=rand()%10+1;
for(int p=0;p<r2;++p)
{
put_to_array[o][p]=rand()%10;
}
}
////////////////////////////////
when I call the function having this code excerpt,
a row of the 2d matrix put_to_array[][]
always has the same elements as others
i.e
1 2 4 5
1 2 4 5
1 2 4 5
Thanks
since I fail to see how I can make rand() function works
in a loop manner
/////////////////////////////////
srand(time(NULL));
int r1=rand()%10+1;
for(int o=0;o<r1;++o){
int r2=rand()%10+1;
for(int p=0;p<r2;++p)
{
put_to_array[o][p]=rand()%10;
}
}
////////////////////////////////
when I call the function having this code excerpt,
a row of the 2d matrix put_to_array[][]
always has the same elements as others
i.e
1 2 4 5
1 2 4 5
1 2 4 5
Thanks