The problem is that modern processors are too fast for your code:
for(int h=0; h<16;h++)
{
srand(time(0));
x[h] = rand()%10;
}
Because they are fast, the calls to
time(0)
are all occurring in the same second, so the value passed to
srand
to initialize the random number generator is always the same, and it gets reset to the same sequence. So every time round the loop, you get the same random number (though a different number each time you run your program).
Move the call to
srand
outside the loop completely so the random number generator is only initialized once, and you will get different values when you call
rand