Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main(){
- vector <int> numbers;
- for (int i = 1; i <= 10; i++)
- numbers.push_back(i);
- // conta todos os elementos do vector
- for (vector<int>::iterator it = numbers.begin(); it != numbers.end(); it++) {
- cout << *it << endl;
- }
- cout <<"\n"<< endl;
- // reverse conta de traz para frente
- for (vector<int>::reverse_iterator itreverse = numbers.rbegin(); itreverse != numbers.rend(); itreverse++) {
- cout << *itreverse << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement