CHAPTER6-18.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER6-18.cpp
- #pragma warning(disable:4786)
- #include <list>
- #include <algorithm>
- #include <iostream.h>
- using namespace std;
- PrintIt (char*& StringToPrint){ cout<<StringToPrint<<endl;}
- void main (void)
- {
- list<char* > Staff;
- list<char* >::iterator PeopleIterator;
- Staff.push_back("John");
- Staff.push_back("Bill");
- Staff.push_back("Tony");
- Staff.push_back("Fidel");
- Staff.push_back("Nelson");
- cout << "The unsorted vector " << endl;
- for_each(Staff.begin(), Staff.end(), PrintIt );
- Staff.sort();
- cout << "The sorted vector " << endl;
- for_each(Staff.begin(), Staff.end(), PrintIt);
- }