Advertisement

06.29.2008 at 12:21PM PDT, ID: 23525262
[x]
Attachment Details

Displaying a queue!

Asked by jschmuff in C++ Programming Language, Programming Languages

Tags: c++

Is there another way to display my queue without using pop? Which empties the queue so I would then have to add to it again before I could display them.

Here is my code:

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
#include <iostream>
#include <queue>
 
using namespace std;
 
int main()
{
	queue<int> intQueue;
 
	intQueue.push(10);
	intQueue.push(20);
	intQueue.push(30);
	intQueue.push(40);
	intQueue.push(50);
	intQueue.push(60);
 
	cout << "The front of the queue: " << intQueue.front() << endl;
	cout << "\nThe last of the queue: " << intQueue.back() << endl;
	
	intQueue.pop();
 
	cout << "\nAfter removing from the queue the front of the queue is now: " << intQueue.front() << endl;
	cout << "\nThe queue now has these in it: " << endl;
	
	while(!intQueue.empty())
	{
		cout << intQueue.front() << " ";
		intQueue.pop();
	}
 
	cout << endl;
 
	cout << intQueue.front();
 
	return 0;	
}
 
Loading Advertisement...
 
[+][-]06.29.2008 at 12:24PM PDT, ID: 21895189

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C++ Programming Language, Programming Languages
Tags: c++
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.29.2008 at 12:34PM PDT, ID: 21895210

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.29.2008 at 12:39PM PDT, ID: 21895226

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 12:48PM PDT, ID: 21895256

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 12:57PM PDT, ID: 21895281

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 02:33PM PDT, ID: 21895568

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 02:36PM PDT, ID: 21895584

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 03:37PM PDT, ID: 21895775

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 10:27PM PDT, ID: 21896786

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 11:41PM PDT, ID: 21897087

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.30.2008 at 07:38AM PDT, ID: 21899496

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 01:38PM PDT, ID: 21934795

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 04:15PM PDT, ID: 21935215

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.05.2008 at 04:04AM PDT, ID: 21936600

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.06.2008 at 06:23AM PDT, ID: 21940200

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07.06.2008 at 02:03PM PDT, ID: 21941625

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628