📄 main.cpp
字号:
#include <stdio.h>
#include <stdlib.h>
//#include "dot.h"
#include "list.h"
#include "tree.h"
#include "mystring.h"
#include "queue.h"
void main()
{
/* mystring a="jakjkjfa;d";
printf("%s\n",a);
list l;
l=newList();
printf("%d\n",lengthList(l));
insertList(l,a,1);
insertList(l,"bb",2);
insertListHead(l,"laopo");
insertList(l,"laogong",2);
insertListTail(l,"ok");
printf("%d\n",lengthList(l));
insertListTail(l,"a");
printf("%d\n",lengthList(l));
insertListTail(l,"b");
printf("%d\n",lengthList(l));
insertListTail(l,"c");
printf("%d\n",lengthList(l));
insertListTail(l,"ddddddd");
printf("%d\n",lengthList(l));
insertListTail(l,"eeeee");
printf("%d\n",lengthList(l));
insertList(l,"ai",2);
insertListHead(l,"we");
printf("\nList:\n");
list q=l->next;
while(q)
{
printf("%s\n",q->element);
q=q->next;
}
printf("\nSIZE:%d\n",lengthList(l));
deleteList(l,7);
printf("\nList:\n");
q=l->next;
while(q)
{
printf("%s\n",q->element);
q=q->next;
}
printf("\nSIZE:%d\n",lengthList(l));
listDeleteHead(l);
printf("\nList:\n");
q=l->next;
while(q)
{
printf("%s\n",q->element);
q=q->next;
}
printf("\nSIZE:%d\n",lengthList(l));
listDeleteTail(l);
printf("\nList:\n");
q=l->next;
while(q)
{
printf("%s\n",q->element);
q=q->next;
}
printf("\nSIZE:%d\n",lengthList(l));
*/
tree t=newTree("apple");
treeInsertVertex(t,"v1");
treeInsertVertex(t,"v2");
treeInsertVertex(t,"v3");
treeInsertVertex(t,"v4");
treeInsertVertex(t,"v5");
treeInsertVertex(t,"v6");
treeInsertVertex(t,"v7");
treeInsertVertex(t,"v8");
treeInsertVertex(t,"v9");
treeInsertEdge (t,"v1","v2");
treeInsertEdge (t,"v1","v3");
treeInsertEdge (t,"v1","v4");
treeInsertEdge (t,"v2","v5");
treeInsertEdge (t,"v4","v6");
treeInsertEdge (t,"v4","v7");
treeInsertEdge (t,"v4","v8");
treeInsertEdge (t,"v6","v9");
vertex vTemp=searchVertex(t,"v1");
printf("treePreOrder:\n");
treePreOrder(t,vTemp);
printf("\ntreeInOrder:\n");
treePostOrder(t,vTemp);
printf("\ntreePostOrder:\n");
treeInOrder (t,vTemp);
printf("\ntreeLevelOrder:\n");
treeLevelOrder(t);
printf("\n");
/*
list p=t->vertices;
p=p->next;
printf("\n\n");
while(p)
{
printf("%s\n",((vertex)(p->element))->vInfo);
p=p->next;
}
printf("\n%d\n",lengthString("zengjunyan"));
printf("%d\n",equalString("lao","lao"));
printf("\n\nvertex:\n");
list l1=t->vertices;
l1=l1->next;
list l2;
vertex vt;
while(l1)
{
vt=(vertex)(l1->element);
l2=vt->edges;
if(l2->next!=NULL)
visit(vt->vInfo);
l1=l1->next;
}
printf("\n");
tree t2=newTree("testTree");
list lTest=t2->vertices;
printf("\n%d\n",listIsEmpty(lTest));
*/
/* queue q=newQueue();
enQueue(q,"a");
enQueue(q,"b");
enQueue(q,"c");
enQueue(q,"d");
enQueue(q,"e");
enQueue(q,"f");
while(!queueIsEmpty(q))
{
poly pp=deQueue(q);
visit(pp);
}
printf("\nsize queue:%d\n",queueIsEmpty(q));
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -