C++ stack增删

int main()
{
    stack<int> test;
    //插入
    test.push(1);
    test.push(2);
    test.push(3);
    //删除
    test.pop();
    cout << test.size() << endl;
    while (!test.empty()){//清空栈
        test.pop();
    }

    return 0;
}

 

posted @ 2018-08-24 15:55  aote369  阅读(131)  评论(0编辑  收藏  举报