📜  c++代码示例中的cout堆栈

📅  最后修改于: 2022-03-11 14:44:55.599000             🧑  作者: Mango

代码示例1
#include 
#include 
#include 

int main(int argc, const char *argv[])
{
    std::stack stack;
    stack.push(1); 
    stack.push(3); 
    stack.push(7); 
    stack.push(19); 

    for (std::stack dump = stack; !dump.empty(); dump.pop())
        std::cout << dump.top() << '\n';

    std::cout << "(" << stack.size() << " elements)\n";

    return 0;
}