#include void order(int & x, int & y) { if (x > y) { int temp = x; x = y; y = temp; } } void main() { int V[1000]; // got 1000 variables called V[0] up to V[999] cout << "How many things to sort (up to 1000)? "; const int N = read_int(); const int max = N - 1; int i = 0; while (i <= max) { V[i] = random_in_range(10, 99); i = i + 1; } cout << "before: "; i = 0; while (i <= max) { cout << V[i] << " "; i = i + 1; } cout << "\n"; // This part of the program sorts N int variables into ascending order int len = max - 1; while (len >= 0) { int i = 0; while (i <= len) { order(V[i], V[i+1]); i = i + 1; } len = len - 1; } cout << "after: "; i = 0; while (i <= max) { cout << V[i] << " "; i = i + 1; } cout << "\n"; }