Mega Code Archive

 
Categories / C++ Tutorial / List
 

Inserting Elements in the List Using push_back

#include <list> #include <iostream> int main () {     std::list <int> listIntegers;     listIntegers.push_back (1);     listIntegers.push_back (2);     listIntegers.push_back (-1);     listIntegers.push_back (9);     std::list <int> ::iterator i;     for ( i = listIntegers.begin (); i != listIntegers.end (); ++ i )         std::cout << *i << std::endl;     return 0; }