suppose i have declared :
queue<int> Q;
I want this Q empty at the beginning of each interation:
t=0;
while(t--)
{
//here I need the Queue empty
// here are oprations with that Q which may leave the queue un-empty at the end
}
what should I do to make my Q empty each time ??
Thanks in advance
Initialize a Queue Empty
Moderator: Board moderators
Initialize a Queue Empty
Syed Ishtiaque Ahmed Kallol
CSE,BUET
Bangladesh
CSE,BUET
Bangladesh
Code: Select all
Q = queue<int>();
-
- Experienced poster
- Posts: 122
- Joined: Tue Apr 16, 2002 10:07 am
Re: Initialize a Queue Empty
Place the variable inside your while loop.
Code: Select all
t=10;
while(t--)
{
queue<int> Q; //here I need the Queue empty
// here are oprations with that Q which may leave the queue un-empty at the end
}