Acasa Tehnologie Interschimbare linie sau coloana matrici

Interschimbare linie sau coloana matrici

by Dragos Schiopu

>

void interschimblinia(int v1, int v2)
{
int aux=0;
for(i=1;i<=n;i++)
{
aux=c[v1][i];
c[v1][i]=c[v2][i];
c[v2][i]=aux;
}
}

void interschimbcoloana(int c1, int c2)
{
int aux2=0;
for(i=1;i<=n;i++)
{
aux2=c[i][c1];
c[i][c1]=c[i][c2];
c[i][c2]=aux2;
}
}

s-ar putea sa-ti placa