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.

p_m06.c
/* ------------------------------------ */
/*  Save as :   p_m06.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(" %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 :

 6 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.
 5 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.


 2 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.