pex13_13.cpp

来自「数据结构C++代码,经典代码,受益多多,希望大家多多支持」· C++ 代码 · 共 51 行

CPP
51
字号
#include <iostream.h>
#include <fstream.h>
#pragma hdrstop

// include the Graph class modified to implement MinimumLength
#include "wex13_25.h"

void main(void)
{
	Graph<char> G;
	char fname[20], startV;

	cout << "Enter the graph file name: ";
	cin >> fname;
	cout << "Enter the starting vertex: ";
	cin >> startV;
	cout << endl;
	
	G.ReadGraph(fname);
	VertexLength(G, startV);
} 

/*
<Run #1>

Enter the graph file name: px13_13a.dat
Enter the starting vertex: A

Minimum length from A to A = 1
Minimum length from A to B = 2
Minimum length from A to C = 2
Minimum length from A to D = 3
Minimum length from A to E = 4
Minimum length from A to F = 3
Minimum length from A to G = -1
Minimum length from A to H = -1

<Run #2>

Enter the graph file name: px13_13b.dat
Enter the starting vertex: A

Minimum length from A to A = 1
Minimum length from A to B = 2
Minimum length from A to C = 3
Minimum length from A to D = 5
Minimum length from A to E = 4
Minimum length from A to F = 6
Minimum length from A to G = 6
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?