Aller au contenu

Mathc matrices/Fichiers c : p m06

Un livre de Wikilivres.


Application


Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r, int c)
{
int    n ;

double **A   = i_mR(r,c);

  for(n = c; n; n--)
      {
       clrscrn();

       printf(" C%d Columns by row\n\n",n);
  
       printf(" A : \n" );
       p_mR(A,S8,P2,n);
       
       stop();
       }
   
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
  do{ 
        fun(rp_I(R4),rp_I(C3)+C3);
        clrscrn(); 
        
   }while(stop_w());       

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

La fonction p_mR(); a quatre paramètres. Le quatrième permet de contrôler le nombre de colonnes dessiné par ligne.

Exemple de sortie écran :

 C6 Columns by row

 A : 

   +0.00    +0.00    +0.00    +0.00    +0.00    +0.00 
   +0.00    +0.00    +0.00    +0.00    +0.00    +0.00 
   +0.00    +0.00    +0.00    +0.00    +0.00    +0.00 
   +0.00    +0.00    +0.00    +0.00    +0.00    +0.00 

 Press return to continue.
 C5 Columns by row

 A : 

   +0.00    +0.00    +0.00    +0.00    +0.00 
   +0.00    +0.00    +0.00    +0.00    +0.00 
   +0.00    +0.00    +0.00    +0.00    +0.00 
   +0.00    +0.00    +0.00    +0.00    +0.00 

   +0.00 
   +0.00 
   +0.00 
   +0.00 

 Press return to continue.


 C2 Columns by row

 A : 

   +0.00    +0.00 
   +0.00    +0.00 
   +0.00    +0.00 
   +0.00    +0.00 

   +0.00    +0.00 
   +0.00    +0.00 
   +0.00    +0.00 
   +0.00    +0.00 

   +0.00    +0.00 
   +0.00    +0.00 
   +0.00    +0.00 
   +0.00    +0.00 

 Press return to continue.