Back
Uncategorized

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 (5×1) 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 (4×5) times c, and store the result in a 4×1 vector called d.
  4. d) Create a 4×2 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. 

 

“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”

The post 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… appeared first on nursing assignment tutor.

 

“Are you looking for this answer? We can Help click Order Now”


 

“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”

The post 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… first appeared on nursing writers.