Current location - Training Enrollment Network - Mathematics courses - Discrete mathematics c language
Discrete mathematics c language
I corrected it myself in an object-oriented way.

# include & ltiostream.h & gt

Template & ltT class & gt

void Warshall( T *a,int m,int n)

{

int i = 0,j = 0;

for(I = 0; I & ltn;; i++)

{

for(j = 0; j & ltm; j++)

{

if( a[j][i] == 1)

{

int k = 0;

for(int x = 0; x & ltn; x++)

{

a[j][k]= a[j][k]| | a[I][k];

k++;

}

}

}

}

for(I = 0; I & ltm;; i++)

{

for(j = 0; j & ltn; j++)

{

cout & lt& lta[I][j]& lt; & lt\ t ';

}

cout & lt& ltendl

}

}

void main()

{

int ai[4][4] = { {0, 1,0,0},{ 1,0, 1,0},{0,0,0, 1},{0,0,0,0 } };

Warshall(ai,4,4);

}