Linear Algebra and the C Language/a0es
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r, int c)
{
int Pn ;
double **A = i_mR(r,c);
for(Pn = P0; Pn<P6; Pn++)
{
clrscrn();
printf(" P%d digits after the decimal point\n\n",Pn);
printf(" A:" );
p_mR(A, S12,Pn,C6);
stop();
}
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do{
fun(rp_I(R4),rp_I(C3)+C2);
clrscrn();
}while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Pn: Allows you to control the number of digits after the point.
Screen output example:
P1 digits after the decimal point
A:
+0.0 +0.0 +0.0 +0.0
+0.0 +0.0 +0.0 +0.0
+0.0 +0.0 +0.0 +0.0
+0.0 +0.0 +0.0 +0.0
Press return to continue.
P2 digits after the decimal point
A:
+0.00 +0.00 +0.00 +0.00
+0.00 +0.00 +0.00 +0.00
+0.00 +0.00 +0.00 +0.00
+0.00 +0.00 +0.00 +0.00
Press return to continue.
P3 digits after the decimal point
A:
+0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000
+0.000 +0.000 +0.000 +0.000
Press return to continue.