相关代码 |
|
"HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"> top cppreference.com > "index.html">C++ Stacks > top top Syntax: #include <stack> TYPE& top(); The function top() returns a reference to the top element of the stack. For example, the following code removes all of the elements from a stack and uses top() to display them: while( !s.empty() ) { cout << s.top() << " "; s.pop(); } Related topics: pop