[ create a new paste ] login | about

Link: http://codepad.org/tO2uZ3YY    [ raw code | output | fork ]

C++, pasted on Nov 25:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <algorithm>
#include <iostream>
#include <vector> 

int main()
{
	int arr[] = {1, 1, 1, 2, 1, 2, 2, 1, 3, 3, 1, 2, 1, 3, 1};
	std::vector<int> v(arr, arr + sizeof(arr)/sizeof(int));

	std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
	std::cout << std::endl;

	std::sort(v.begin(), v.end());
	v.erase(std::unique(v.begin(), v.end()),  v.end());

	std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));

	return 0;
}


Output:
1
2
1 1 1 2 1 2 2 1 3 3 1 2 1 3 1 
1 2 3 


Create a new paste based on this one


Comments: