CHAPTER8-40.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER8-40.cpp
- #include <list>
- #include <iostream>
- #if _MSC_VER > 1020 // if VC++ version is > 4.2
- using namespace std; // std c++ libs implemented in std
- #endif
- void main(void)
- {
- list<double> MyList;
- int N = 0;
- while(N < 6)
- {
- MyList.push_back(N + 3.14);
- N++;
- }
- list<double>::iterator M = MyList.begin();
- while(N)
- {
- cout << "MyList : " << *M << endl;
- M++;
- N--;
- }
- N = MyList.size();
- M = MyList.end();
- M--;
- cout << " Reverse Direction-----------" << endl;
- while(N)
- {
- cout << "MyList : " << *M << endl;
- M--;
- N--;
- }
- }