Tue Apr 06, 2010 5:56 am
a. int [ ] [ ] aIntMatrix;
b. int [ ][ ] bIntMatrix;
c. int [ ][ ] cIntMatrix;
d. double [ ] [ ] aDblMatrix;
e. double [ ][ ] bDblMatrix;
f. double [ ][ ] cDblMatrix;
a. int [ ] [ ] aIntMatrix = new int[m][n];
b. int [ ][ ] bIntMatrix = new int[j][k];
a. int [ ][ ] cIntMatrix = new int[m][k]; for op == “MULTIPLY”
b. int [ ][ ] cIntMatrix = new int[m][n]; for op == “ADDITION” or “SUBTRACTION”
If dataType is integer Switch(op) {
Case + : { cIntMatrix = addMatrix(aIntMatrix, bIntMatrix); printMatrix(aIntMatrix); printMatrix(bIntMatrix); printMatrix(cIntMatrix); break;
}
Case - : {
}
Case * : {
}
Else
Case + : {
}
Case - : {
}
Case * : {
}
}
Switch(op) {
}
for(int i = 0; i < ... ; i++) for(int j = 0; j < ... ; j++)
c[ i ][ j ] = a[ i ][ j ] + b[ i ][ j ];
for(int i = 0; i < ... ; i++) for(int j = 0; j < ... ; j++)
c[ i ][ j ] = a[ i ][ j ] - b[ i ][ j ];
for(int k = 0; k < columns of c; k++) for(int i = 0; i < rows of b; i++)
for(int j = 0; j < columns of a ; j++) c[ i ][ k ] = a[ i ][ j ] * b[ j ][ k ]
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.