[ create a new paste ] login | about

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

C++, pasted on Jul 12:
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	vector <int> g1;
	vector <int> :: iterator i;
	vector <int> :: reverse_iterator ir;

	for (int i = 1; i <= 7; i++)
		g1.push_back(i);

	cout << "Output of begin and end\t:\t";
	for (i = g1.begin(); i != g1.end(); ++i)
		cout << *i << '\t';

	cout << endl << endl;
	cout << "Output of rbegin and rend\t:\t";
	for (ir = g1.rbegin(); ir != g1.rend(); ++ir)
		cout << '\t' << *ir;

        cout<<endl<<"capacity is"<<g1.capacity();

	return 0;

}


Output:
1
2
3
4
Output of begin and end	:	1	2	3	4	5	6	7	

Output of rbegin and rend	:		7	6	5	4	3	2	1
capacity is8


Create a new paste based on this one


Comments: