Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language programming! Two-dimensional plastic array!
C language programming! Two-dimensional plastic array!
Testing of Third-order Matrix (3-row and 3-column 2D Array)

Test of Five-order Matrix (Five-row and Five-column Two-dimensional Array)

# include & ltstdio.h & gt

# include & ltstdlib.h & gt

Void matrix _multi(int* m, int col, int mul)

{

int i,j;

for(I = 0; I & ltcoli++)

{

? for(j = 0; j & ltI+ 1; j++)

? {

? m[I * col+j]= m[I * col+j]* mul;

? }

}

}

int main(int argc,char *argv[])

{

int i,j;

int * m;

int col

int mul

Printf ("Set matrix order (number of rows):");

scanf("%d ",& ampcol);

m =(int *)malloc((col * col)* sizeof(int));

for(I = 0; I & ltcoli++)

{

? Printf ("Line %d of input matrix (end of enter key):", I+1);

? for(j = 0; j & ltcolj++){

? scanf("%d ",& ampm[I * col+j]);

? }

}

Printf ("Triangle Multiplier under Input Matrix:");

scanf("%d ",& ampmul);

Printf ("\ n \ tOriginal matrix: \ n");

for(I = 0; I & ltcoli++)

{

? for(j = 0; j & ltcolj++){

? printf("%-5d ",m[I * col+j]);

? }

? printf(" \ n ");

}

/* Call the trigonometric multiplication function under the matrix */

matrix_multi(m,col,mul);

Printf ("\ n \ tProcessed matrix: \ n");

for(I = 0; I & ltcoli++)

{

? for(j = 0; j & ltcolj++){

? printf("%-5d ",m[I * col+j]);

? }

? printf(" \ n ");

}

Free (m);

Returns 0;

}