[ create a new paste ] login | about

Project: khaotic
Link: http://khaotic.codepad.org/3V9cRHUd    [ raw code | output | fork ]

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

using namespace std;
int main(void) {
vector<int>var;
for(int x=1;x<=10;x++) var.push_back(x);
cout << "Forward:";
vector<int>::iterator lol;
for(lol=var.begin();lol<var.end();lol++) cout << " " << *lol;
cout << "\nReverse:";
vector<int>::reverse_iterator x;
for(x=var.rbegin();x<var.rend();x++) cout << " " << *x;

return 0;
}


Output:
1
2
Forward: 1 2 3 4 5 6 7 8 9 10
Reverse: 10 9 8 7 6 5 4 3 2 1


Create a new paste based on this one


Comments: