// UVa 11462 - Age Sort #include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { vector<short int> a; int n; cin >> n; while (n) { a.clear(); for (int i = 0; i < n; i++) { int b; cin >> b; a.push_back(b); } sort(a.begin(), a.end()); vector<short int>::const_iterator I = a.begin(); cout << *I; for (I++; I != a.end(); I++) cout << " " << *I; cout << endl; cin >> n; } }
No comments:
Post a Comment