Mathc matrices/Fichiers c : p m05
Installer et compiler ce fichier dans votre répertoire de travail.
![]() |
p_m05.c imprime les décimales |
---|
/* ------------------------------------ */
/* Save as : p_m05.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 = 0; n<6; n++)
{
clrscrn();
printf(" %d digits after the decimal point\n\n",n);
printf(" A : \n" );
p_mR(A,12,n,C6);
stop();
}
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do{
fun(rp_I(R4),rp_I(C3)+2);
clrscrn();
}while(stop_w());
return 0;
}
La fonction p_mR(); a quatre paramètres. Le troisième permet de contrôler le nombre de chiffres après la virgule.
Exemple de sortie écran :
0 digits after the decimal point
A :
-22 +12 -34 -41
+49 -22 -28 +1
+41 +29 -76 +100
Press return to continue.
1 digits after the decimal point
A :
-21.6 +11.7 -34.4 -41.4
+48.6 -21.7 -27.7 +0.9
+40.6 +28.8 -76.2 +99.7
Press return to continue.
2 digits after the decimal point
A :
-21.59 +11.73 -34.39 -41.44
+48.55 -21.73 -27.72 +0.90
+40.59 +28.76 -76.15 +99.67
Press return to continue.
3 digits after the decimal point
A :
-21.587 +11.728 -34.393 -41.443
+48.554 -21.725 -27.723 +0.900
+40.594 +28.760 -76.151 +99.666
Press return to continue.
4 digits after the decimal point
A :
-21.5870 +11.7280 -34.3930 -41.4430
+48.5540 -21.7250 -27.7230 +0.9000
+40.5940 +28.7600 -76.1510 +99.6660
Press return to continue.