Initialize deque with 26 copies of the letter x : deque « Deque « C++






Initialize deque with 26 copies of the letter x

  
 

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

int main()
{
  // Initialize deque1 with 26 copies of the letter x:
  deque<char> deque1(26, 'x');

  deque<char>::iterator i;

  cout.precision(10);

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

  return 0;
}

/* 
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x

 */        
    
  








Related examples in the same category

1.Use generic deque to store integers
2.Use generic deque to store chars
3.Use generic deque to store strings
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))