返回列表 發帖

矩陣反轉

  1. The following C program is to perform matrix mulitplication and print out the result
  2. #include<stdio.h>
  3. #define ROW1 2
  4. #define ROW2 4
  5. #define COL 3
  6. void multiply(int [][COL],int[][ROW2],int[][ROW2]);

  7. int void(void)
  8. {
  9.   int array[ROW1][COL]={{1,2,3},
  10.                         {4,5,6}};
  11.   int array2[COL][ROW2]={{3,6,1,2},
  12.                          {5,4,3,2},
  13.                          {1,2,5,6}};
  14.   int result[ROW1][ROW2];
  15.   
  16.   multiply(array1,array2,result);//call the function multipy
  17.   size_t i,j;
  18.   for(i=0;i<ROW1;i++)
  19.   {
  20.     for(int j=0;j<ROW2;j++)
  21.     {
  22.       printf("%d ",result[i][j]);
  23.     }
  24.     printf("\n");
  25.   }
  26.   return 0;

  27. }
複製代碼
Please finish the definition/code of the function multiply(), which recevies two two-dimensional arrays(array1 and array2),perform the martrix multiplication, and then store the outcome in the third two-dimensional array(result).
istak.teach2@gmail.com

此帖僅作者可見
istak.teach2@gmail.com

TOP

返回列表