Prototype 1 Prototype 3

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int size, i; cin >> size; vector<int> array(size); for (i = 0; i < size; i++) { array[i] = rand(); } sort(array.begin(), array.end()); for (i = 0; i < size; i++) { cout << array[i] << endl; } return 0; }

To improve performance, the algorithm reading integers can be tuned to match the properties of the integer string (See Input routines):





To improve security, the implementation of rand() can be chosen among (See Pseudorandom number generators):



The implementation of sort can be chosen among (See Sorting algorithms):