Mathc matrices/Fichiers c : p02a

Un livre de Wikilivres.


Étude du code


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

c00.c
/* ------------------------------------ */
/*  Save as :   c00.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **Xp_mR(
double **A,  // R3xC8
int er,
int dr,
int n_cMAX   // C3
)
{
int r;
int c;

int c_LAST;
int c_FIRST;

int THE_LAST_c_TO_WRITE = C1;

      //        C1        <    C9
while(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])
     {
		 
	               c_FIRST = THE_LAST_c_TO_WRITE; //C1	 
	 
      THE_LAST_c_TO_WRITE += n_cMAX;  //C1+C3=C4
                            
            //       C4      <     C9               
      if(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])       
                              c_LAST  = THE_LAST_c_TO_WRITE; //C4
      else                             //    C9
                              c_LAST  = A[C_SIZE][C0];
              
      //           R1<R4
 	  for(r=R1; r<A[R_SIZE][C0]; r++)
         {
          printf("\n");
          //             C1<C9
 	      for (c=c_FIRST; c<c_LAST; c++)
 	           //                      Rr Rc
               printf("%+*.*f ",er,dr,A[r][c]);
          }
          
      printf("\n");
     }
     
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
  double **A = r_mR(i_mR(R3,C8),99.);

  printf(" A[R%d,C%d] :  p_mR(A,S4,P0, C3 );\n",rsize_R(A),
                                                csize_R(A));
  Xp_mR(A,S4,P0,C3);
  
  f_mR(A);
  
  stop();

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


Imprimer une matrice mathématique de R3xC8 avec C3 colonnes par lignes.


Exemple de sortie écran :

  A[R3,C8] :  p_mR(A,S4,P0, C3 );

 +29  -73  -24 
 +43  +80  +99 
 +55  -96  +74 

 +56  -70  -42 
 -61  +27  -45 
 +14  -52  -82 

  -6  +96 
 -92  +33 
 -78  +60 
 Press return to continue.