Generation

generate functionSun, 13 Nov 2022

Sort a vector of integers

void sort(int v[], int n) { for (int i = 0; i < n - 1; i++) { int minIndex = i; for (int j = i + 1; j < n; j++) { if (v[j] < v[minIndex]) { minIndex = j; } } int t = v[i]; v[i] = v[minIndex]; v[minIndex] = t; } }

Want to kickstart your project?Use the new AI Studio to create your code