Computer Science Homework Solutions
Problem
#172438

Matrix Multiplication Program Using Arrays

Attached are the requirements for the program.

You are going to write a program to multiply two matrices.
The matrices are stored in a two-dimensional array:
int[][] matrixA
int[][] matrixB

Recall:
Here is the way to declare a two-dimensional array:
int testArray[3][4] = {{1,2,3,4},{2,3,4,1},{5,4,3,0}}; // three rows, four columns
/*
after declaration, testArray will be like:
1 2 3 4
2 3 4 1
5 4 3 0
*/

This link may help you recall how to multiply two matrices
http://en.wikipedia.org/wiki/Matrix_multiplication
Your program should be like this:

/*
this program multilies two matrices
*/
#include
/* include other libs */

using namespace std;

int main()
{
/* step1: declare three arrays here:
matrixA (3*4), 3 rows, 4 columns
matrixB (4*3),
and result (3*3)
*/

/* step2: compute the result */

/* step3: output the result */
}

The values of matrices in your program can be hard-coded and any numbers you like(including the numbers of columns/rows and the values of matrices), which means you do not have to ask user to input those numbers. Of course you can do this if you would like to.

Attached file(s):
Attachments
matrix program.docx  View File
Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$19.95)
Included in Download
  • Plain text response
  • Attached file(s):
    • main.cpp
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • C++ two-dimensional array - Write a program using a two-dimensional array that is essentially a multiplication table that, given two factors, looks up the product in the table.
  • Please explain the following - Explain what a one-dimensional array and its components are. Explain why arrays are useful, and how they are created within Visual Basic .NET. Finally, explain how two-dimensional arrays are d ...
  • C++ Programming (Arrays and Strings) - See attach file.
  • Pointers and virtual functions - a. Write a statement that declares table to be a pointer to pointer of type double b. Write C++ statements that create table to be a two-dimensional array of five rows and seven columns
  • Storing three-dimensional homogeneous arrays - Describe a method for storing three-dimensional homogeneous arrays. What addressing formula would be used to locate the entry in the ith plane, jth row, and the kth column?
Browse