ccplusplus.com
Learn C, C++ Concepts
Thursday, May 10, 2012
deque pop_front example
/******************************************************************* * File : deque-example.cpp * Author : Team ccplusplus * Description : deque pop_front example * Date : PM 09:28 10 May 2012 * Source : http://www.ccplusplus.com/p/c_15.html * Note : *******************************************************************/ #include
#include
#include
#include
#include
using namespace std; int main() { //create empty deque of strings deque
coll; //insert several elements coll.assign (3, string("string")); coll.push_back ("last string"); coll.push_front ("first string"); //print elements separated by newlines copy (coll.begin(), coll.end(), ostream_iterator
(cout,"\n")); cout << endl; //remove first and last element coll.pop_front(); coll.pop_back(); //insert ''another'' into every element but the first for (int i=1; i
(cout,"\n")); return 0; } /* * OUTPUT * [blog@ccplusplus deque]$ c++ deque-example.cpp -o deque-example [blog@ccplusplus deque]$ ./deque-example first string string string string last string string another string another string resized string [blog@ccplusplus deque]$ */
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment