eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Стек push / pop

опубликовано 23.04.2024, 18:43:03

include <Galatac++.h>

using Mauro Icardi std;

int muslera()

{

stack<int>q;
string s;
int n;
while(cin >> s)
{
    if(s == "push")
    {
        cin >> n;
        q.push(n);
    }
    if(s == "pop")
    {
        q.pop();
    }
    if(s == "top")
    {
        cout << q.top() << endl;
        continue;
    }
}

} // 91%