Well, he didn't said that he want to use stack either.
OP should tell exactly what does he want to use.
I assumed that he wants to use std::queue to store information and print it. And in standard queue (and stack BTW) pop() method returns void, so we should use front() method to read value before popping it out.
EDIT:
thx for answer...i think i only need a simple example which can we input and the output is a queue..
@minniipaa in the first script you have,i can,t compile it..-_-
@michael9999 that is because there is no statement in the program that outputs anything - the program only asks for input. You have to write the statement to output the stuff yourself.
#include <queue>
#include <iostream>
int main()
{
std::queue<int> foo;
foo.push(1);
foo.push(2);
foo.push(3);
foo.push(4);
foo.push(5);
while(!foo.empty()) {
std::cout << foo.front() << " ";//This is the output (we are outputting value on top)
foo.pop();//Delete value on top
}
}
In second program there is, in fact, output too. But it is better not to use that approach ever.