[ create a new paste ] login | about

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

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

int main()
{
	std::vector<int> v(1, 1);

	std::vector<int>::iterator it1 = std::find(v.begin(), v.end(), 1);
	v.insert(it1, 0);

	std::vector<int>::reverse_iterator it2 = std::find(v.rbegin(), v.rend(), 1);
	v.insert(it2.base(), 2);

	for(std::vector<int>::const_iterator it = v.begin(); it != v.end(); ++it)
		std::cout << *it;
}


Output:
1
012


Create a new paste based on this one


Comments: