Aller au contenu

Mathc complexes/Fichiers c : c01d

Un livre de Wikilivres.


Application

Installer et compiler ces fichiers dans votre répertoire de travail.

c00c.c
/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include "w_a.h" 
/* ------------------------------------ */
#define ARRAY  A3
/* ------------------------------------ */
void fun(int r,int c)
{
double **A[ARRAY];
int i;

  /* Create and initialize the array elements. */
  for(i=A0; i<ARRAY; i++)
 
      A[i] = r_mZ(i_mZ(r,c),99);           
 
  clrscrn();

  /* Display the table elements. */
  for(i=A0; i<ARRAY; i++)
     {
	  printf(" A[%d]:",i);      
      p_mZ(A[i], S5,P0, S3,P0, C6);
     } 

  /* Release the elements from the array. */     
  for(i=A0; i<ARRAY; i++)
  
       f_mZ(A[i]); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(C5),rp_I(C5));

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La boucle "for" permettra de travailler sur l'ensemble du tableau.

Exemple de sortie écran :

 A[0]:
  -49+68i   +68-46i   -29+10i   +87-15i   -66+80i 
  -54+43i   +97+39i    -1 +9i   -47-94i   +83-56i 
  +48-31i   -98+90i   -62-97i   +24+93i   -40-71i 

 A[1]:
  -28+83i   -52-86i   -13-42i    -6-94i   +14+65i 
  -48+88i   -98-90i   +13+74i   -36+14i   -30-18i 
  -39 +1i   +28+45i   +72+12i   -68-89i   -79 +3i 

 A[2]:
  +38-29i   +29-59i   -37+97i   -34-18i   +88+95i 
  -70+79i    +5 -3i   -46-71i   +76+55i   +38+60i 
  -91-46i   -51+82i   +25-96i   +82-29i   +41+65i 


 Press   return to continue
 Press X return to stop