queue

November 12, 2019 ยท View on GitHub

Description : The Queue is a abstract data type that is a lnlo (last in last out) meaning that the first element that you push will be the first element to pop. Below are examples of Constructor's to inialize a queue Example :

#include <iostream>
#include <queue>

int main(void)
{
    // Create a empty queue
    std::queue<int> emptyConstructor;
    
    // Push a value to it so it is no longer empty
    emptyConstructor.push(3);
    
    // Copy the above queue
    std::queue<int> copiedConstructor(emptyConstructor);
    
    std::cout << emptyConstructor.front() << std::endl;
    
    std::cout << copiedConstructor.front() << std::endl;
        
	return 0;
}

Run Code