Skip to content

Latest commit

 

History

History
97 lines (53 loc) · 3.13 KB

File metadata and controls

97 lines (53 loc) · 3.13 KB

 

 

 

 

 

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

  • STL STL: GNU ISO C++ Library, version 4.9.2

 

 

 

 

 

Qt project file: ./CppIteratorExample1/CppIteratorExample1.pro

 


TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt QMAKE_CXXFLAGS += -Wall -Wextra -Weffc++ -Werror SOURCES += main.cpp

 

 

 

 

 

./CppIteratorExample1/main.cpp

 


#include <iostream> #include <list> int main() {   std::list<int> my_list;   my_list.push_back( 1);   my_list.push_back( 4);   my_list.push_back( 9);   my_list.push_back(16);   my_list.push_back(25);   my_list.push_back(36);   my_list.push_back(49);   //Display the list (not preferred)   typedef std::list<int>::const_iterator Iterator;   const Iterator j = my_list.end();   for (Iterator i = my_list.begin(); i!=j; ++i)   {     std::cout << *i << '\n';   } } /* Screen output: 1 4 9 16 25 36 49 Press <RETURN> to close this window... */