2070 / C / Списки

 


Черга STL
#include <queue>

queue<int> q;

q.push(1);

q.push(3);

q.push(5);

printf("%d ", q2.front()); // 1

q2.pop(); // видалити 1

 
Очистити

queue<int> empty;

swap(q2, empty);

 


 

 
Стек STL
#include <stack>

stack steck;

steck.push(1);

steck.push(3);

steck.push(5);

printf("%d ", steck.top());  // 5

steck.pop();   // видаляємо 5