CIS 160 Homework 6 solution

CIS 160 Homework 6 solution

For this assignment you will turn in:


In class(10pts):


1.       A statement of the problem (typed)


2.       An explanation of your solution (typed)


3.       A flowchart (hand-drawn or computer generated)


4.       Pseudocode (typed)


Via BlackBoard(40pts):


1.       C program named <username_matrix_mult.c




Follow the steps that we have outlined in class for algorithm development to generate a program that takes in two matrices (A and B) and multiplies them, then outputs the result. Remember matrix multiplication is NOT just C[0][0] = A[0][0]*B[0][0]. To multiply two matrices (A and B) together first, the number of columns in A must equal the number of rows in B. So A (4x2) x B (2x3) = C (4x3). Matrix multiplication works as follows:



= ( ⋮

⋮ ) ,  = ( ⋮

⋮ )



×  = (  ⋮


  ℎ          = ∑                ∗



In short, you multiply each individual element of the row of A to the corresponding element of the column of B and then sum them.





-          Dimensions of each array (n x m)


-          The elements of each matrix (A and B)




-          The resulting matrix C=A x B




1.  void printMatrix(int row, int col, float m[row][col])


a.       prints a nicely formatted matrix


2.  float calcEntry(float x[], float y[])


a.       Takes the ith row of A and the jth column from B in order to calculate C[i][j]

b.      Returns the value that will be put into C[i][j]


*  This is the minimum functions that you must use. You may use others if you like.




1.       This is individual work. You may NOT work in groups.


2.       Please staple all work together.


3.       You are expected to error check.


4.       For code: No compile = No points, no exceptions!
Powered by