The error is at the end, when you try to output the array. If you want to print the content of an array you can't do
cout << sample[x];
Instead, you have to scan the array element by element and print each value.
After the for loop ends, x is 8 so,
cout <<sample[x];
will try to output element simple[8] which is not possible since the array 'simple' 's size is 8.
If you would like to print all the elements in the array. As minomis said, you have to loop this array again and print each element.