Instead of printing to standard output, push_back to a std::vector<int>.
Type: Posts; User: laserlight
Instead of printing to standard output, push_back to a std::vector<int>.
This is wrong:
a[5] = i;
The array a has 5 elements, so a[5] does not exist. Even if it did, it does not make sense to assign i to it since i was not initialised.
This is wrong:
for(i = 1;...
You should have nested loops. The inner loop would just print the elements of the array. The outer loop would loop for the desired number of times, and then shuffle the array before control enters...