- //文件名:CHAPTER4-8.cpp
- #include <string.h>
- #include <algorithm>
- #include <vector>
- #include <stdlib.h>
- #include <iostream.h>
- using namespace std;
- main ()
- { vector<int> v;
- int input;
- int n=0;
- cout<<"Please input 10 integers"<<endl;
- while ((++n)&&(n<11)) { cin >> input; v.push_back (input); }
- sort(v.begin(), v.end());
- n = v.size();
- cout<<"output the 10 sorted integers:"<<endl;
- for (int i = 0; i < n; i++) cout << v[i] << " ";
- }