tc2.cpp
来自「数据结构c++语言描述 Borland C++实现」· C++ 代码 · 共 34 行
CPP
34 行
// compute transitive closure
// of a directed graph
#include<iostream.h>
#include "ldg2.h"
#include "make2db.h"
void main(void)
{
LinkedDigraph G(0);
int **TC;
Make2DArray(TC,20,20);
// try three graphs
for (int j = 1; j <= 3; j++) {
G.Input();
cout << "The input digraph is" << endl;
G.Output();
G.TransitiveClosure(TC);
int n = G.Vertices();
cout << "The transitive closure is" << endl;
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++)
cout << TC[j][k] << ' ';
cout << endl;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?