Home > Back-end >  Novice to solve, what code I died, couldn't compile want!!!!!!!!!!
Novice to solve, what code I died, couldn't compile want!!!!!!!!!!

Time:10-03

to write a function to achieve an array of transpose operations, is a two-dimensional array of rows and columns element swaps, forming another two dimensional array, such as:
A array b array
1 2 3 4 5 9
5 6 7 8 2 10
9 10 11 12 3 7 11
4 August 12
# include
using namespace std;

Int a move (int matrix [3] [4], int Max [4] [3]) {
int i,j;
for(i=0; i<3; I++) {
for(j=0; j<4. J++) {
Matrix [I] [j]=Max [j] [I];
}
}
The return of Max [4] [3].
}
Int main () {
int i,j;
Int m=1;
The int data [3] [4], the day [4] [3].
for(i=0; i<3; I++)
for(j=0; j<4. J++) {
Data [I] [j]=m;
M++;
}
cout<" It is: "& lt; for(i=0; i<3; I++) {
for(j=0; j<4. J++)
coutcout}
Move (data, day);
cout<" Changed: "& lt; for(i=0; i<4. I++) {
for(j=0; j<3; J++)
coutcout}
return 0;
}

CodePudding user response:

 # include 
using namespace std;

Void move (int matrix [3] [4], int Max [4] [3])
{
int i,j;
for(i=0; i<3; I++)
{
for(j=0; j<4. J++)
{
Max [j] [I]=matrix [I] [j];//don't assign the!!!!
}
}
//return Max [4] [3].//return with?
}

Int main ()
{
int i,j;
Int m=1;
The int data [3] [4], the day [4] [3].
for(i=0; i<3; I++)
for(j=0; j<4. J++)
{
Data [I] [j]=m;
M++;
}
cout<" It is: "& lt; for(i=0; i<3; I++)
{
for(j=0; j<4. J++)
coutcout}
Move (data, day);

cout<" Changed: "& lt; for(i=0; i<4. I++)
{
for(j=0; j<3; J++)
coutcout}
return 0;
}

CodePudding user response:

upstairs
  • Related