[ create a new paste ] login | about

Link: http://codepad.org/v9eKcN3g    [ 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 <= 54; 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	24	25	26	27	28	29	30	31	32	33	34	35	36	37	38	39	40	41	42	43	44	45	46	47	48	49	50	51	52	53	54	

Output of rbegin and rend	:		54	53	52	51	50	49	48	47	46	45	44	43	42	41	40	39	38	37	36	35	34	33	32	31	30	29	28	27	26	25	24	23	22	21	20	19	18	17	16	15	14	13	12	11	10	9	8	7	6	5	4	3	2	1
capacity is64


Create a new paste based on this one


Comments: