// stlsort.cpp -- demo of STL sort function // cmc, 5/22/2010 #include #include #include using namespace std; // utility print function for integer array void pr(int a[], int n) { for (int i=0; i v(a, a+n); // copy array to vector sort(v.begin(), v.end()); // sort vector copy(v.begin(), v.end(), a); // copy back to array } // simple main int main() { int x[] = {72, 91, 4, 13, 7, 6, 50, 25, 44, 1}; int n = 10; cout << "before sorting:"; pr(x,n); vecsort(x,n); cout << "after sorting:"; pr(x,n); return 0; }