Created
November 27, 2012 15:43
-
-
Save Jack2/4154927 to your computer and use it in GitHub Desktop.
[C++]STL_list_example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <list> | |
using namespace std; | |
int main() | |
{ | |
list<int> JL; | |
JL.push_back(100); | |
JL.push_front(999); | |
JL.push_back(200); | |
list<int>::iterator li; | |
for (li=JL.begin(); li!=JL.end(); ++li) | |
{ | |
cout << *li << endl; | |
} | |
JL.clear(); | |
JL.push_front(888); | |
for (li=JL.begin(); li!=JL.end(); ++li) | |
{ | |
cout << *li << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment