closure.cpp

来自「数据结构c++语言描述 Borland C++实现」· C++ 代码 · 共 30 行

CPP
30
字号

// reflexive transitive closure

#include<iostream.h>
#include "ad1.h"
#include "make2db.h"

void main(void)
{
   AdjacencyDigraph G(0);
   int **RTC;
   Make2DArray(RTC,21,21);

   // try three graphs
   for (int j = 1; j <= 3; j++) {
      G.Input();
      cout << "The input graph is" << endl;
      G.Output();

      G.ReflexiveTransitiveClosure(RTC);
      cout << "The reflexive transitive closure is" << endl;
      int n = G.Vertices();
      for (int i = 1; i <= n; i++) {
         for (int j = 1; j <= n; j++)
            cout << RTC[i][j] << " ";
         cout << endl;
         }
      }
}

⌨️ 快捷键说明

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