CHAPTER5-5.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER5-5.cpp
- #include <iostream>
- #include <deque>
- using namespace std;
- int main ()
- { deque< int > d;
- d.push_back (4); // Add after end.
- d.push_back (9);
- d.push_back (16);
- d.push_front (1); // Insert at beginning.
- for (int i = 0; i < d.size (); i++) cout << "d[" << i << "] = " << d[i] << endl;
- cout << endl;
- d.pop_front (); // Erase first element.
- d[2] = 25; // Replace last element.
- for (i = 0; i < d.size (); i++) cout << "d[" << i << "] = " << d[i] << ",";
- return 0;
- }