I created a random number generator (between 100 and 1) for an Array but each time I run it it outputs the same 10 numbers between 1 and 100.
for (int x=0; x < 10; x++) {
arr[x]=rand() % 100 + 1;
The Loop runs 10 times because the array contains 10 integers. Every time I run this though, it outputs: 42, 68, 35, 1, 70, 25, 79, 59, 63, 65.
It Outputs from this line of code
for (int z=0; z<10;z++) {
cout << arr[z]<<", ";
}
Can anyone see why this is happening?