1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//~ #include <sstream>
using namespace std;
 
int main()
{
	typedef vector<int> int_vector;
	typedef istream_iterator<int> istream_itr;
	typedef ostream_iterator<int> ostream_itr;
	typedef back_insert_iterator<vector<int> > back_ins_itr;
	//~ vector
	int_vector ivec;
	//~ 从标准输入读整数到vector容器
	copy(istream_itr(cin), istream_itr(), back_ins_itr(ivec));
	//~ 排序
	sort(ivec.begin(), ivec.end());
	//~ 输出到标准输出
	copy(ivec.begin(), ivec.end(), ostream_itr(cout, "\n"));
	return 0;
}
Tags: ,.
你好!除了代码,此处没有多少原创之物,皆为本人搜集、整理、总结之记录与心得,欢迎转载分享!转载时请尽量注明出处,将不胜感激。祝你健康、快乐!
Home

RFC: Request For Comments. Orz..

Name(required)
Mail (required),(will not be published)

RFC: Request For Comments. Orz..

Website(recommended)