Demonstrating the STL vector push_back functions : vector push pop heap « Vector « C++






Demonstrating the STL vector push_back functions

   
 

#include <iostream>
#include <cassert>
#include <vector>
#include <string>
#include <algorithm>  // for reverse
using namespace std;


int main()
{
  string s("qwer");

  vector<char> vector1(s.begin(), s.end());

  vector<char> vector2;

  vector<char>::iterator i;

  for (i = vector1.begin(); i != vector1.end(); ++i)
    vector2.push_back(*i);

  for (i = vector2.begin(); i != vector2.end(); ++i)
    cout << *i;

  return 0;
}

/* 
qwer
 */        
    
    
  








Related examples in the same category

1.Perform the heapsort with push_heap and pop_heap
2.Inserting Elements in a vector Using the push_back Method
3.Read data from a file and save that to vector