Answered You can hire a professional tutor to get the answer.

QUESTION

Use fscanf() to read the data from HW4Problem2.txt into a matrix called B. Note that you need to use fgets() to avoid the header row. Make a note of...

Use fscanf() to read the data from HW4Problem2.txt into a matrix called B. Note that you need to use fgets() to avoid the header row. Make a note of B's dimensions. Next, do the following

  1. a) Print the matrix B with each element in the same position as it was in the text file, but with integer format for the 1st and 3rd column, fix-point format with a precision of 2 for the 2nd column, and exponential format with a precision of 5 for the last column. Put two tabs (t) between each column.
  2. b) Multiply each element of the first column in HW4Problem2.txt by each element of the 3rd column of HW4Problem2.txt and store the result in a column vector (5x1) called c. WARNING: you better compare what you stored in B and what is in HW4Problem2.txt.
  3. c) Do array multiplication with the values in B (4x5) times c, and store the result in a 4x1 vector called d.
  4. d) Create a 4x2 array called M. The first column of M is the index of each row of d and the second column of M is the
  5. corresponding value of d.
  6. e) Use one fprintf() call to output 4 lines, each with the following form:
  7. "The value of d at the i index of d is x.xxxxxxE+yy."
  8. where i ranges from 1 to 4 and represents the value of the index for the value of d that is being printed. 
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question