Hi Jerry,
here is the main code, I've writen so far. Let me know if you need to see
more....
Thanks
JC
-----------------
int main()
{
queue_num Q;
queue_tempg T;
int QCount, i, n, count;
// char ans;
Q.clear_queue();
T.clear_tempg();
i = 0;
QCount = 0;
count = 0;
cout <<"\n\tEnter a number\n\t==> ";
while ( !(Q.full_queue() ) )
{
cin >> n;
Q.insert_queue(n);
QCount++;
count++;
}
int rem;
cout <<"\n\tEnter a number to remove==> ";
cin >> rem;
if ( !(Q.empty_queue()) )
{
QCount = 0;
while ( !(Q.empty_queue() ) && ( QCount <= maxqueue ) )
{
if (rem == Q.queuearray[QCount] )
{
cout << "\n\tI found number "<<rem";
Q.delete_queue(QCount);
while ( !(Q.empty_queue()) )
{
n = Q.queuearray[QCount];
T.insert_tempg(n);
QCount++;
}
}
else
{
n = Q.queuearray[QCount];
cout << "\n\tNumber "<<rem<<" was NOT found";
T.insert_tempg(n);
QCount++;
}
}
}
---------------------------------
"Jerry Coffin" <jcoffin@taeus.com> wrote in message
news:MPG.1a05bc7d78f8b0c5989bb1@news.clspco.adelph ia.net...[color=blue]
> In article <r6udnXQS-fkAZAaiRVn-gA@comcast.com>,
keepit@secret.com
> says...[color=green]
> > Hello all,
> >
> > I was wondering if someone can give me some tips on this problem.
> >
> > I'm trying to take content of a queue (Xqueue) and copy it into another
> > queue (Yqueue)
> > I tried using a while and/or for loop.
> >
> > for example if queue X contains numbers (3,5,8,6)
> > I want to copy number (3,5) into queue Y, then I want to delete number 8
> > from queue X.
> > I then want to copy number (6) to queue Y (to keep them in order)
> > I'll then move them back to queue X which at this point will look like[/color][/color]
this[color=blue][color=green]
> > (3,5,6)[/color]
>
> Why don't you try to tell us more precisely what you want as a result
> instead of the way you're trying to produce that result?
>
> Right now, it's not clear exactly what criteria you're using to decide
> that 8 should be removed from the queue, nor is it clear exactly why you
> have two queues involved. Just for example, something like this might
> be useful: "I have an std::queue of int's and I want to remove from it
> any item that is greater than the number that follows it."
>
> Posting a minimal piece of compilable code that demonstrates what you're
> doing is also _very_ helpful.
>
> --
> Later,
> Jerry.
>
> The universe is a figment of its own imagination.[/color]