Mathc matrices/Fichiers c : p m06

Un livre de Wikilivres.
Sauter à la navigation Sauter à la recherche


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

Crystal Clear mimetype source c.png p_m06.c
nb de colonne par ligne
/* ------------------------------------ */
/*  Save as :   p_m06.c                */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r, int c)
{
int    n ;

double **A   = rE_mR(i_mR(r,c),99999,  1E-3);

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

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

  srand(time(&t));
  
  do{ 
        fun(rp_I(R4),rp_I(C3)+3);
        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 : 

  +17.65    -8.42   +62.57   +80.02   +39.82    -4.63 
  +25.90   -68.28   -44.62   -64.39   +62.54   -95.04 
  -68.32   -40.77   -96.73   -63.65   +23.54   -82.79 
  -27.18   +70.11   -45.72    +5.86   -69.89    +7.77 

 Press return to continue.
5 Columns by row

 A : 

  +17.65    -8.42   +62.57   +80.02   +39.82 
  +25.90   -68.28   -44.62   -64.39   +62.54 
  -68.32   -40.77   -96.73   -63.65   +23.54 
  -27.18   +70.11   -45.72    +5.86   -69.89 

   -4.63 
  -95.04 
  -82.79 
   +7.77 

 Press return to continue.
 4 Columns by row

 A : 

  +17.65    -8.42   +62.57   +80.02 
  +25.90   -68.28   -44.62   -64.39 
  -68.32   -40.77   -96.73   -63.65 
  -27.18   +70.11   -45.72    +5.86 

  +39.82    -4.63 
  +62.54   -95.04 
  +23.54   -82.79 
  -69.89    +7.77 

 Press return to continue.
 3 Columns by row

 A : 

  +17.65    -8.42   +62.57 
  +25.90   -68.28   -44.62 
  -68.32   -40.77   -96.73 
  -27.18   +70.11   -45.72 

  +80.02   +39.82    -4.63 
  -64.39   +62.54   -95.04 
  -63.65   +23.54   -82.79 
   +5.86   -69.89    +7.77 

 Press return to continue.
2 Columns by row

 A : 

  +17.65    -8.42 
  +25.90   -68.28 
  -68.32   -40.77 
  -27.18   +70.11 

  +62.57   +80.02 
  -44.62   -64.39 
  -96.73   -63.65 
  -45.72    +5.86 

  +39.82    -4.63 
  +62.54   -95.04 
  +23.54   -82.79 
  -69.89    +7.77 

 Press return to continue.
 1 Columns by row

 A : 

  +17.65 
  +25.90 
  -68.32 
  -27.18 

   -8.42 
  -68.28 
  -40.77 
  +70.11 

  +62.57 
  -44.62 
  -96.73 
  -45.72 

  +80.02 
  -64.39 
  -63.65 
   +5.86 

  +39.82 
  +62.54 
  +23.54 
  -69.89 

   -4.63 
  -95.04 
  -82.79 
   +7.77 

 Press return to continue.