CHAPTER7-4.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER7-4.cpp
- #include <iostream>
- #include <deque>
- #if _MSC_VER > 1020 // if VC++ version is > 4.2
- using namespace std; // std c++ libs implemented in std
- #endif
- typedef deque<int > INTDEQUE;
- void printcontents (INTDEQUE deque);
- void main()
- { INTDEQUE dequetest;
- dequetest.push_back(1);
- dequetest.push_back(2);
- dequetest.push_back(3);
- printcontents (dequetest);
- dequetest.pop_back();
- printcontents (dequetest);
- dequetest.pop_back();
- printcontents (dequetest);
- }
- //function to print the contents of deque
- void printcontents (INTDEQUE deque)
- { INTDEQUE::iterator pdeque;
- cout <<"The output is:"<<endl;
- for(pdeque = deque.begin(); pdeque != deque.end(); pdeque++)
- { cout << *pdeque <<" "; }
- cout<<endl;
- }