Use generic deque to store strings : deque « Deque « C++






Use generic deque to store strings

  
 


#include <iostream>
#include <cassert>
#include <deque>
#include <algorithm>  // For find
using namespace std;


int main()
{
  string x[5] = {"1234", "2345", "3456","4567", "5678"};

  deque<string> deque1(&x[0], &x[5]);

  // Search for the first occurrence of the letter e:
  deque<string>::iterator i;

  cout.precision(10);

  for (i = deque1.begin(); i != deque1.end(); ++i)
    cout << *i << endl;
  return 0;
}

/* 
1234
2345
3456
4567
5678

 */        
    
  








Related examples in the same category

1.Use generic deque to store integers
2.Use generic deque to store chars
3.Initialize deque with 26 copies of the letter x
4.create a deque
5.Use std::copy to print out all elements in a deque
6.deque.push_back( value )
7.deque.push_front( value )
8.Create your own stack based on deque
9.Combine insert and end to add elements to a deque
10.Save transformed data from vector to deque (Vector1 + Vector2 = Result (in Deque))