alright so basically i'm doing an assignment where i have to have people enter their name and it puts it in a queue. i also have to be able to display the queue at anytime and thats where i'm stuck. id like to be able to send all of the queue info automatically to a different fine and at anytime i can press 'A' (as in the code that follows) and it will show the queue info. anyhelp would be great! here's my code so far. basic C++ syntax and i'm using codeblocks:
#include <iostream>
#include <list>
#include <queue>
#include <string>
usingnamespace std;
int main()
{
queue<string> myqueue;
string strName;
char cContinue;
char cAccess;
while(1)
{
cout << "Hello! Welcome to C++ Bank of America! \n" << endl;
cout << "If you do not wish to wait in line, enter '0' and leave the bank. \n" << endl;
cout << "If you wish to continue, press any key" << endl;
cin >> cContinue;
if(cContinue != '0')
{
cout << "Please enter your Name" << endl;
cin >> strName;
myqueue.push (strName);
cout << "Thank you for choosing C++ Bank of America!" << endl;
cout << "To Accsess the queue, please enter 'A'. Otherwise, please press any key." << endl;
if(cAccess != 'A')
}
}
return 0;
}
Please edit your post and put the source inside code tags. It will make it a lot more legible and folks here will be more likely to pay attention to it.
The solution unfortunately appears to be not so reasonable. The above link will lead you to demonstration on how to gain access to the protected member of the adaptor classes. This should be standard compliant (unless stuff in the standard gets "cleaned").
This post mentions compacting the underlying vector when dealing with stack and priority queue. The advice is not to do it, but I just wanted to say that the likes of your problem (accessing the underlying container of the adaptors) comes up apparently.
Regards
EDIT: Thought about it again. The above solution is very esoteric and probably you will need simpler alternative. You can use the deque container. Queues are not very thick layer above deque, so the transition will be simple.