diff --git a/README.md b/README.md index 70c6f53..581b47e 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,85 @@ void printff(){ ``` ##C3:创建邻接矩阵、打印邻接矩阵和执行Dijkstra算法{152-230} ``` -代码: +void createjz(){//创建邻接矩阵函数 + edgenode *p; + aaa(); + int i; + for(i=0;ia,nm.adjust[h].name)) break; + cont[i][h]=1; + p=p->next; + } + } +} + void print() { + edgenode* p; + int i; + for(i=0;i[%s]",p->a); + p=p->next; + } + printf("\n"); + } +} + int num2=0; + int money=0; + void Dijkstra(int v1,int v2){ + int dist[MAX],s[MAX],path[MAX];//s判断v1是否已经判断最短路径,path前驱 + int min,i,j,u,pre; + for(i=0;i",nm.adjust[pre].name); + money++; + pre=path[pre]; + } + printf("%s",nm.adjust[pre].name); + } + else printf("路径不存在!"); + } + } + printf("\n"); +} ``` ##C4:打印菜单,实现功能{231-312} ```