- //文件名:CHAPTER8-11.cpp
- #include <iostream>
- #include <list>
- #if _MSC_VER > 1020 // if VC++ version is > 4.2
- using namespace std; // std c++ libs implemented in std
- #endif
- #include <list>
- #include <iostream>
- int main( )
- {
- list <int> c1;
- list <int>::size_type i;
- c1.push_back( 1 );
- i = c1.size( );
- cout << "List length is " << i << "." << endl;
- c1.push_back( 2 );
- i = c1.size( );
- cout << "List length is now " << i << "." << endl;
- }