Similar Problems

Similar Problems not available

queue::front() function in C++ STL

In C++, the standard library gives us the facility to use the Queues as a type of container adaptors which operate in a first in first out (FIFO) type of arrangement. The queue::front() is a C++ Standard Library function which is used to get the first element of a queue.

Syntax

Queue_Name.front( );

Parameter: The queue::front() function does not accepts any parameter.

Return value: The queue::front() function returns the reference the first element of the queue container.

Example of queue::front() Function

Program

#include <iostream>

#include <queue>

using  namespace std;

int  main()

{

queue<int> QUE;

QUE.push(1);

QUE.push(4);

QUE.push(3);

QUE.push(7);

cout << QUE.front();

return 0;

}

Output

1