01 2021 档案
摘要:#include<iostream> #include<string> using namespace std; void test1(){ string s1;//默认构造 创建一个空字符串 cout<<s1<<endl; const char *s2="hello c++";//字符串初始化(c
阅读全文
摘要:#include<iostream> #include<queue>//队列容器 #include<string> using namespace std; class person{ public: person(string name,int age){ m_name=name; m_age=a
阅读全文
摘要:#include<iostream> using namespace std; //顺序存储的循环队列 const int maxsize=5; class cir_queue{//Circular queue 循环队列 public: int data[maxsize]; int front; i
阅读全文
摘要:数据结构中的链栈可以由c++STL的stack容器实现 以下是常见函数: #include<iostream> #include<stack> using namespace std; /* stack是一种先进后出的数据结构 只有一个出口 栈中只有顶端的元素才可以被外界使用,因此栈不允许有遍历行为
阅读全文
摘要:#include<iostream> using namespace std; //栈的顺序存储结构--顺序栈 //栈是一种特殊的线性表 const int maxsize=100; class s_stack{//Sequential stack 顺序栈 public: s_stack(const
阅读全文
摘要:#include<iostream> #include<list>//类似于双向循环链表 using namespace std; void show(list<int>l){//输出容器list中的内容 for(list<int>::iterator it=l.begin();it!=l.end(
阅读全文
摘要:数据结构中的双向循环链表可以用c++STL库中的list容器代替. 以下是网上资料: 1.关于list容器 list是一种序列式容器。list容器完成的功能实际上和数据结构中的双向链表是极其相似的,list中的数据元素是通过链表指针串连成逻辑意义上的线性表,也就是list也具有链表的主要优点,即:在
阅读全文
摘要:#include<iostream> using namespace std; //循环单链表 class point{//结点类 public: int data; point *next; }; class line{//单链表 public: int length; point *head;
阅读全文
摘要:#include<iostream> using namespace std; //单链表 class point{//结点类 public: int data; point *next; }; class line{//单链表 public: int length; point *head; li
阅读全文
摘要:#include<iostream> using namespace std; // 建立顺序存储的线性表 const int maxsize =100;//定义maxsize=100 template<class T> class olist{//olist=order list(顺序表) pub
阅读全文

浙公网安备 33010602011771号