Home > database >  Don't the zha will just learning C language, who can tell me this how to write?
Don't the zha will just learning C language, who can tell me this how to write?

Time:09-29

Title description
Write a function that given a 3 x3 two-dimensional integer array transposed, namely swaps, data input and output are completed in the main function,

The input description
Please input a 3 x3 each element of the array, separated with a space between

Output description
Output transposed respectively before and after the transpose array
The output format for % 5 d

The input sample
1 2 3 4 5 6 7 8 9

The output sample
The original array
1 2 3
4 5 6
7 8 9
Convert an array
1 4 7
2 5 8
3 6 9

CodePudding user response:

#include
3//# define maxsize macro definition order determinant
Int main ()
{
Int a [maxsize] [maxsize], b [maxsize] [maxsize];
for(int i=0; i{
for(int j=0; j{
The scanf (" % d ", & amp; A [I] [j]);
}//press column enter
}
Printf (" the original array \ n ");
for(int i=0; i{
for(int j=0; j{
B [I] [j]=[j] [I];//ranks swap
Printf (" % 5 d, "a [I] [j]);
}
printf("\n");//a list of upload a newline
}
Printf (" convert array \ n ");
for(int i=0; i{
for(int j=0; j{
Printf (" % 5 d, b [I] [j]);
}
printf("\n");
}
return 0;
}
  • Related