Linear Algebra and the C Language/a0f4
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00d.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void p4_mR(
double **A,
int er,
int dr
)
{
int r;
int c;
for (r = R1; r < A[R_SIZE][C0]; r++)
{
for (c = C1; c < A[C_SIZE][C0]; c++)
printf("%+*.*f ",er,dr,A[r][c]);
printf("\n");
}
}
/* ------------------------------------ */
void fun(int r,int c)
{
double **A = r_mR(i_mR(r,c),9);
clrscrn();
printf(" A: p_mR(A, S10,P2,C8);");
p_mR(A, S10,P2,C8);
printf(" A: p4_mR(A, S10,P2 );\n");
p4_mR(A, S10,P2);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(R2)+R2, rp_I(C4)+C2);
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Control the size of the columns and the number of digits to display after the decimal point:
Screen output example:
A: p_mR(A, S10,P2,C8);
+5.00 +6.00 -6.00 -1.00 -9.00
-5.00 -6.00 -7.00 -5.00 +2.00
-7.00 -3.00 -7.00 -2.00 -3.00
A: p4_mR(A, S10,P2 );
+5.00 +6.00 -6.00 -1.00 -9.00
-5.00 -6.00 -7.00 -5.00 +2.00
-7.00 -3.00 -7.00 -2.00 -3.00
Press return to continue
Press X return to stop