HW8 - /* MAE9: Homework #8, Fall 2006 Due on Monday,...

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

View Full Document Right Arrow Icon
/* MAE9: Homework #8, Fall 2006 Due on Monday, November 16, before 9:00 pm In main(), read the number of rows (=rows) and the number of columns (=cols) from the first row of the file "matrix5.dat". If rows!=cols exit the program. the remaining rows of the file contain the values of matrix a[rows][cols] and the values of b[rows]. Allocate memory for double **a, *b, *c. In a for-loop for each row, read the values for a[row]. Print the values a[][] using %9.3f on the screen. From the file, read the last line as the elements of b[]. Print the values of b[] using %9.3f on the screen. Compute c[] = a[][] * b[] and print the values of c[] using %9.3f. ---------(Output Sample)------------------------------------------------ rows = 7 cols = 7 a[][]: [0] 10.000 9.000 8.000 7.000 6.000 5.000 4.000 [1] 9.000 11.000 -6.000 8.000 3.000 -2.000 5.000 [2] 8.000 -6.000 12.000 10.000 -8.000 -6.000 4.000 [3] 7.000 8.000 10.000 14.000 13.000 -6.000 5.000 [4] 6.000 3.000 -8.000 13.000 16.000 14.000 -9.000 [5]
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/22/2008 for the course MAE 9 taught by Professor Lubarda during the Fall '07 term at UCSD.

Page1 / 3

HW8 - /* MAE9: Homework #8, Fall 2006 Due on Monday,...

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

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