Inserting Elements in a vector Using the push_back Method : vector push pop heap « Vector « C++






Inserting Elements in a vector Using the push_back Method

   
#include <iostream>
#include <vector>

int main ()
{
    std::vector <int> v;

    // Insert sample integers into the vector
    v.push_back (50);
    v.push_back (1);
    v.push_back (987);
    v.push_back (1001);

    std::cout << v.size () << " Elements";

    return 0;
}
  
    
    
  








Related examples in the same category

1.Perform the heapsort with push_heap and pop_heap
2.Demonstrating the STL vector push_back functions
3.Read data from a file and save that to vector