Computer Scientists are Pretty Pessimistic

Tuesday, 1 March 2016

Use of Queue in C++

#include <iostream>
#include <queue>
using namespace std;
int main ()
{
    queue<int>q;
    int val;
    for(int i=0;i<10;i++)
    {
        cin>>val;
        q.push(val);
    }
    while(!q.empty())
    {
        cout<<q.front()<<endl;
        q.pop();
    }
    return 0;
}

No comments:

Post a Comment