logo

Crowdly

You are given a ROWS x COLS integer matrix called mat , and another array calle...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

You are given a ROWS x COLS integer matrix called mat, and another array called shift of ROWS numbers. (ROWS and COLS are #defined constants). You have to circularly shift the numbers of each row of mat to the right by the number of positions mentioned in the corresponding value in the shift array. Your C program should print the modified matrix along with column-wise totals. Here is an illustrative example:

   	mat	 	   shift			     mat 

3      4      -2      16         1    16      3   4     -2

12     76     0       5          4   after right shifting  12   76   0      5

16     7      100     -70  6        ---------->      100   -70     16      7

   -----------------------

   128     9  20     10

   -----------------------

Note that the shift operation is not valid for negative numbers (which means negative input in shift array should be appropriately dealt with). Your program should be commented well, written modularly, and use the following functions that you must define and use, in addition to any others you may wish to write:

void populateMatrix(); /* takes values into the matrix */

void RightShiftRow(); /* shifts a given row by the value specified */

void printMatrixAndColTotals();

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на dle.plaksha.edu.in?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome