1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| int main ()
{
int i,j,l,c,s;
int **M;
int *tabplus,x;
int *tabmoins,y;
do
{
printf("donner le nombre de lignes",l);
scanf("%d",&l);
printf("donner le nombre de colonnes ",c);
scanf("%d",&c);
}
while (l!=c);
M= (int **) malloc (l*sizeof(int*)) ;
for(i=0 ; i<l ; i++)
*(M+i)=(int *) malloc (c*sizeof(int)) ;
for(i=0 ; i<l ; i++)
{
for(j=0 ; j<c ; j++)
{
printf("M[%d][%d]",i,j);
scanf("%d",M[i]+j);
}
}
tabplus=(int *)malloc (c*sizeof(int));
for (x=0;x<l;x++)
scanf("%d",tabplus+x);
tabmoins=(int *)malloc (c*sizeof(int));
for (y=0;y<l;y++)
scanf("%d",tabmoins+y);
printf("donner un sommet",s);
scanf("%d",&s);
tabplus[s]=1;
tabmoins[s]=1;
for (j=0;j<c;j++);
{
i=s;
if(M[i][j]==1)
for(x=0;x<l;x++)
tabplus[j]=1;
else
tabplus[j]=0;
}
printf("%d\t",*(tabplus+x));
for (i=0;i<l;i++);
{
if(M[i][s]==1)
for(y=0;y<l;y++)
tabplus[i]=1;
else
tabplus[i]=0;
}
printf("%d\t",*(tabmoins+y));
return 0;
} |
Partager