Addition of a transposed and original matrix
I want to add a transposed matrix and original matrix but i cent seem to get it..
can anyone help? Here's my code so far:
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 57 58
|
float average()
{
float Matrix[3][3];
float Matrix2[3][3];
float Addmatr[3][3];
int i,j;
cout << "please enter three sets of three numbers: " << endl;
for ( i = 0; i < 3; i++)
{
for ( j = 0; j < 3; j++)
{
cin >> Matrix[i][j];
}
}
Matrix[i][j] = Matrix2[j][i];
cout << "The transposed matrix is: " << endl;
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
cout << Matrix[j][i] <<" ";
}
cout << endl;
}
Addmatr[3][3] = Matrix [i][j] + Matrix2 [j][i] ;
cout << "The sum of the original and transposed array is: " << endl;
for ( i = 0; i < 3; i++)
{
for ( j = 0; j < 3; j++)
{
cout << Addmatr[i][j];
}
}
return 0;
}
|
It all has to be done in this function
Last edited on
Considering the declaration float Matrix[3][3];
then Matrix[i][j]
would refer to a cell, just one cell, always.
what I don't understand is that you figure out that you needed loops in order to perform i/o
Topic archived. No new replies allowed.