Acasa Tehnologie Graf simetric

Graf simetric

by Dragos Schiopu

>

//verifica daca un graf orientat este simetric 
//sau antisimetric
# include <stdio.h>
# include <conio.h>

void main(void)
{
int a[50][50],n,i,j,ok=1;
FILE *f=fopen("c:intrare3.txt","r");

fscanf(f,"%d",&n);
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
fscanf(f,"%d",&a[i][j]);
fclose(f);
for(i=1;i<=n;i++)
for(j=i;j<=n;j++)
if(a[i][j]!=a[j][i]) ok=0;
if(ok==1)printf("Graf simetric!");
else printf("Graf antisimetric!");
getch();
clrscr();
}

s-ar putea sa-ti placa