I went through the library <queue> standard library. When we want to initialize a queue using that we use the follwing code segmant.
queue<string> q;
But there is no parameter accepting the number of elements in a queue. So i think the above definition is for dynamic arrays (queue).
I want to define a queue which exactly has 5 elements. How can i de it?
You cannot force the queue container to have a maximum of 5 elements. But, you can achieve that goal
if you create a wrapper class as Denis suggested.