stl
清欢0581
社会底层码农正一步步往上爬
展开
-
queue队容器 输出通过重载输出流运算符输出
#include<iostream> using namespace std; #include<queue> class person { public: person(string name, int age) { this->m_name = name; this->m_age = age; } string m_name; int m_age; }; //重载输出流运算符对queue容器进行输出 ostream& operator&原创 2021-06-02 20:44:12 · 105 阅读 · 0 评论 -
队列容器 queue容器
#include<iostream> using namespace std; #include<queue> class person { public: person(string name, int age) { this->m_name = name; this->m_age = age; } string m_name; int m_age; }; //ostream operator<<(person& p) //{ //原创 2021-06-02 20:21:28 · 88 阅读 · 0 评论 -
stack 栈容器的使用 满足的 数据结构是先进后出
#include<iostream> using namespace std; #include<stack> void test01() { //创建一个stack容器 stack<int>s; //入栈 s.push(0); s.push(10); s.push(20); s.push(30); cout << "栈的大小:" << s.size() << endl; ;// 栈满足先进后出 先放进去的元素在栈的底部原创 2021-06-02 19:18:01 · 139 阅读 · 1 评论