?? exam8-2.cpp
字號:
#include <iostream.h>
#include <stdlib.h>
typedef char VerT; //定義鄰接矩陣圖類中的VerT
typedef char DataType; //定義順序表類中的DataType
const int MaxVertices = 100; //定義最大頂點個數
const int MaxQueueSize = 100; //定義隊列的最大個數
const int MaxWeight = 10000; //定義權值的無窮大
#include "AdjMWGraph.h" //包含鄰接矩陣的圖類
#include "CreatAdjMWGraph.h" //包含鄰接矩陣圖的創建函數
void Printchar(char item)
{
cout << item<<" ";
}
void main(void)
{
AdjMWGraph g;
char a[] = {'A','B','C','D','E'};
RowColWeight rcw[] = {{0,1,10},{0,4,20},{1,3,30},{2,1,40},{3,2,50}};
int n = 5, e = 5;
CreatGraph(g, a, n, rcw, e);
cout << "深度優先搜索序列為:";
g.DepthFirstSearch(Printchar);
cout << endl << "廣度優先搜索序列為:";
g.BroadFirstSearch(Printchar);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -