qfedu-cpp-level/day9/stl_deque_demo/d6.cpp

19 lines
416 B
C++
Raw Permalink Normal View History

#include <bits/stdc++.h>
using namespace std;
int main()
{
deque<string> d1(5, "disen");
d1.push_front("jack");
d1.push_back("mack");
d1.insert(d1.begin() + 1, "lucy");
cout << "first element is: " << d1.front() << endl;
cout << "last element is: " << d1.back() << endl;
deque<string>::iterator it = d1.begin();
cout << "second element is: " << *(it + 1) << endl;
return 0;
}