Iterator

#include <iostream>
#include<vector>
#include<iterator>
using namespace std;
int main()
{
    
    vector< int > v;
    vector< int > :: iterator i;
 v.push_back( 15 );
 v.push_back( 16 );
 v.push_back( 17 );
 v.push_back( 18 );
  
 for( i = v.begin(); i < v.end(); i++ ) {
 printf("%d\n", *i);
 }
    system("pause");
    return 0;
}

This is the output:
15
16
17
18

0 comments:

Post a Comment