Advertisement
Jambix64

Vector+iperatorUpdate2

Sep 4th, 2016
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7.  namespace variavel1{
  8.  int tm;
  9.  
  10. }
  11.  // Use scope resolution operator
  12.  namespace variavel2 {
  13.  
  14.      int receive1, receive2, receive3;
  15.  
  16.     }
  17. int main(){
  18.     using namespace variavel1;
  19.  
  20.     vector <int> v(3);
  21.     variavel2::receive1 = v[0] = 100;
  22.     variavel2::receive2 = v[1] = 200;
  23.     variavel2::receive3 = v[2] = 600;
  24. //  prtIT aponta para o primeiro elemento
  25. //  vector <int>::iterator prtIT = v.begin();
  26.  
  27.     vector <int>::iterator ptrIT;
  28.  
  29.     for (ptrIT=v.begin(); ptrIT !=  v.end(); ptrIT++) {
  30.         cout << *ptrIT << endl;
  31.     }
  32.  
  33.     // Saida foi
  34.     //100
  35.     //200
  36.     //600
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement