⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aar_mul_r.c

📁 一些矩阵运算的C代码实现:矩阵一般运算
💻 C
字号:
/*         .h         freeware           http://groups.yahoo.com/group/mathc/ */

/* --------------------------------- INCLUDES ------------------------------- */
#include "v_ahfile.h"
/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void AB(int n, int p, int q)
{
mR mA ={n,p,init_mR(n,p)};
mR mB ={p,q,init_mR(p,q)};
mR mAB={n,q,init_mR(n,q)};
/*-------------------------------- PROGRAM ---------------------------------- */
  rnd_mR(&mA,9);
  rnd_mR(&mB,9);

  clrscrn();
  printf(" A ");p_mR(&mA);
  printf(" B ");p_mR(&mB);
  getchar();
  mul_mR( &mA,&mB,&mAB);
  printf(" AB");p_mR(&mAB);

 free(   mA.pb);
 free(   mB.pb);
 free(  mAB.pb);
}

void hello(void)
{
  printf("\n Freeware by : xhunga bernard 06000 Nice France.\n");
  printf("\n                                                  ");
  printf("\n            Mutiply two matrices                  ");
  printf("\n            ********************                \n");
  printf("\n The size of mA, mB, mAB : 1x1 ... 6x6.         \n");
  printf("\n     ex : \"multmRR.exe\"                       \n");
  printf("\n You can choose the size :                      \n");
  printf("\n     ex : \"multmR.exe 2 3 5\" -> 2x3 3x5 = 2x5   ");
  printf("\n          \"multmR.exe 1 5 2\" -> 1x5 5x2 = 1x2   ");
  printf("\n          \"multmR.exe 4 2 1\" -> 4x2 2x1 = 4x1   ");
  printf("\n          \"multmR.exe 5 5 5\" -> 5x5 5x5 = 5x5   ");
  printf("\n\n                                                ");
  printf("\n Distributed  by :  http://www.simtel.net/        ");
  printf("\n                                                  ");
  printf("\n Press return to continue                          ");
  printf("\n                                                  ");
  getchar();
}


/* --------------------------------- MAIN ----------------------------------- */
int main(int argc, char *argv[])
{
time_t t;
int    n;
int    p;
int    q;

/*-------------------------------- PROGRAM ---------------------------------- */
  srand(time(&t));
  hello();
do
{
if( argc == 4 && atoi(argv[1])&& atoi(argv[2]) && atoi(argv[3]) )
 {n = atoi(argv[1]); if( n > 6){n=6;}
  p = atoi(argv[2]); if( p > 6){p=6;}
  q = atoi(argv[3]); if( q > 6){q=6;}}
else
 {    n=rndp_I(6);       p=rndp_I(6);     q=rndp_I(6);}
   if(n<1){n=1;}     if(p<1){p=1;}     if(q<1){q=1;}


  AB(n,p,q);


  printf("\n Press 'X' Return to stop\n");
} while(toupper(getchar())!='X');

  return 0;
}












⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -