Homework

# Homework - Homework#7 Program Hw7_3 Written by Justin...

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

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);

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

View Full Document
} //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)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

Homework - Homework#7 Program Hw7_3 Written by Justin...

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

View Full Document
Ask a homework question - tutors are online