具体代码如下
1 #include<iostream> 2 using namespace std; 3 4 void Input(int a[25][2],int s) 5 { 6 int i; 7 8 for (i = 0; i < s; i++) 9 { 10 cin >> a[i][0] >> a[i][1]; 11 } 12 } 13 14 void Output(int a[5][2],int b[5][5], int n,int s) 15 { 16 int i; 17 int j, k; 18 int buff=0; 19 int buff1, buff2; 20 cout << endl<< "the relation is :" << endl; 21 for (i = 0; i < s; i++) 22 { 23 buff1 = a[i][0] - 1; 24 buff2 = a[i][1] - 1; 25 b[buff1][buff2] = 1; 26 } 27 for (j = 0; j < n; j++) 28 { 29 for (k = 0; k < n; k++) 30 { 31 cout << b[j][k] << " "; 32 buff++; 33 if (buff%n == 0) 34 cout << endl; 35 } 36 } 37 cout << endl; 38 } 39 void IsReflexive(int b[5][5],int n) 40 { <