Mathc complexes/Fichiers c : swap r
Apparence
Installer et compiler ce fichier dans votre répertoire de travail.
swap_r.c |
---|
/* ------------------------------------ */
/* Save as : swapr.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
int main(void)
{
double a[R3*(C3*C2)] ={ 1,1, 1,1, 1,1,
2,2, 2,2, 2,2,
3,3, 3,3, 3,3};
double **A = ca_A_mZ(a,i_mZ(R3,C3));
int r1 = R1;
int r2 = R3;
clrscrn();
printf(" A :");
p_mZ(A, S5,P0, S4,P0, C6);
printf(" swapR_mZ(A,R%d,R%d)\n\n",r1,r2);
printf(" A :");
p_mZ(swapR_mZ(A,r1,r2), S5,P0, S4,P0, C6);
f_mZ(A);
stop();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La fonction swapR_mZ(); échange deux lignes.
Exemple de sortie écran :
A :
+1 +1i +1 +1i +1 +1i
+2 +2i +2 +2i +2 +2i
+3 +3i +3 +3i +3 +3i
swap_r_Z(A,R1,R3)
A :
+3 +3i +3 +3i +3 +3i
+2 +2i +2 +2i +2 +2i
+1 +1i +1 +1i +1 +1i
Press return to continue.