[ create a new paste ] login | about

Link: http://codepad.org/EdDGcApq    [ 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 <= 23; 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	8	9	10	11	12	13	14	15	16	17	18	19	20	21	22	23	

Output of rbegin and rend	:		23	22	21	20	19	18	17	16	15	14	13	12	11	10	9	8	7	6	5	4	3	2	1
capacity is32


Create a new paste based on this one


Comments: