fork download
  1. #include <string>
  2. #include <list>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. list<string> names;
  10. names.push_back("Mary");
  11. names.push_back("Zach");
  12. names.push_back("Elizabeth");
  13. list<string>::iterator iter = names.begin();
  14. while (iter != names.end()) {
  15. cout << *iter << endl;
  16. ++iter;
  17. }
  18. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
Mary
Zach
Elizabeth