Aller au contenu

Mathc complexes/051

Un livre de Wikilivres.

Application

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

add_z.c
/* ------------------------------------ */
/*  Save as :   add_z.c                 */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
int main(void)
{
nb_Z a;
nb_Z b;
nb_Z aplsb;

  clrscrn();

  a     =   i_Z(-2,+3);
  b     =   i_Z(+5,-9);
  aplsb = add_Z(a,b);

 printf(" (%+.1f %+.1f) + (%+.1f %+.1f) ="
        " (%+.1f %+.1f) \n\n\n",
        
             a.r,     a.i, 
             b.r,     b.i,
         aplsb.r, aplsb.i );
 stop();

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

Nous utilisons ici l'addition des nombres complexes.

Exemple de sortie écran :

   ( -2.0 +3.0i ) + ( +5.0 -9.0i ) =  +3.0 -6.0i 


 Press return to continue.