CHAPTER8-12.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER8-12.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
- int main( )
- { list <int> c1;
- c1.push_back( 10 );
- c1.push_back( 20 );
- c1.push_back( 30 );
- c1.resize( 4,40 );
- cout << "The size of c1 is " << c1.size( ) << endl;
- cout << "The value of the last element is " << c1.back( ) << endl;
- c1.resize( 5 );
- cout << "The size of c1 is now " << c1.size( ) << endl;
- cout << "The value of the last element is now " << c1.back( ) << endl;
- c1.resize( 2 );
- cout << "The reduced size of c1 is: " << c1.size( ) << endl;
- cout << "The value of the last element is now " << c1.back( ) << endl;
- }