Linear Algebra and the C Language/a03a
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00f.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r, int c)
{
double **A = r_mR(i_mR(r,c),9);
double **sD = i_mR(r,c);
double s = 100;
clrscrn();
printf(" A :\n");
p_mR(A,S4,P0,C5);
printf(" %.0f * D :\n",s);
mul_sDA_mR(s, A, sD);
p_mR(sD,S4,P0,C5);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(R4,R4);
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
+4 +3 +2 +6
-9 +9 +7 -1
+7 +7 +8 -7
+6 -7 -1 -9
100 * D :
+400 +3 +2 +6
-9 +900 +7 -1
+7 +7 +800 -7
+6 -7 -1 +900
Press return to continue
Press X return to stop