#include <iostream>
#include <deque>
using namespace std;
int main()
{
deque<int> dequeObject;
deque<int>::reverse_iterator rp;
int i;
for(i = 0; i <10; i++)
dequeObject.push_back(i);
cout << "Contents printed backward:\n";
rp = dequeObject.rbegin();
while(rp != dequeObject.rend()) {
cout << *rp << " ";
rp++;
}
cout << "\n\n";
cout << "Contents printed forward:\n";
rp = dequeObject.rend();
while(rp != dequeObject.rbegin()) {
rp--;
cout << *rp << " ";
}
return 0;
}
|