C ++ STL stack and stlstack

Source: Internet
Author: User

C ++ STL stack and stlstack

Because vector is used, we forget to have a stack. Today we only need to think about the value at the top of the stack. stack is very convenient and easy to use. Let's look at the following example:

1 # include <stack> 2 # include <iostream> 3 using namesapce std; 4 5 int main (void) 6 {7 stack <int> v; 8 v. push (0); 9 v. push (1); 10 cout <v. size () <endl; 11 cout <v. top () <endl; 12 cout <v. empty () <endl; 13 v. pop (); 14 cout <v. top () <endl; 15 16}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.