Homework - Homework #7 /* * Program Hw7_3 * Written by...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #7 /* * Program Hw7_3 * Written by Justin Waters * inputs: none * Outputs: Matrix * Description: The program takes two 3X3 matrices and multiplies them together to get a new single 3X3 matrix * */ #include <stdio.h> #include <stdlib.h> #include <math.h> //prototypes void multiplier(const double x[][3], const double y[][3], double z[][3]); void explain(void); int main (void) { FILE *fpin1, *fpin2; //declares file pointers double x[3][3], y[3][3], z[3][3]; int a, b,i,j; explain(); //calls explain function fpin1 = fopen("xmatrix.txt", "r"); //opens file for x matrix //checks for file opening if(fpin1 == NULL) { printf("\n\nFile does not exist so you cannot proceed"); exit(1); } fpin2 = fopen("ymatrix.txt", "r"); //opens file for y matrix //checks for file opening if(fpin2 == NULL) { printf("\n\nFile does not exist so you cannot proceed"); exit(1);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} //imports values from file of x matrix (loop) for(a = 0; a < 3; a++) { for(b = 0; b < 3; b++) { fscanf(fpin1,"%lf", &x[a][b]); } } //imports values from file of y matrix (loop)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Homework - Homework #7 /* * Program Hw7_3 * Written by...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online