Linear Algebra and the C Language/a0fh
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_r_mR(
double **A,
int n
)
{
int r;
int c;
for (r=R1; r<A[R_SIZE][C0]; r++)
for (c=C1; c<A[C_SIZE][C0]; c++)
A[r][c] = r_I(n);
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r, int c)
{
double **A = r_mR(i_mR(r,c),9);
clrscrn();
printf(" r_mR() : positive and negative numbers \n\n"
" A[R%d,C%d] :",rsize_R(A),csize_R(A));
p_mR(A,S4,P0,C5);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(R8),rp_I(C9));
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Positive and negative numbers:
Screen output example:
r_mR() : positive and negative numbers
A[R3,C9] :
-6 +6 -7 +5 +6
+2 -8 +9 -9 +6
-9 -9 +1 -8 +6
-9 +5 -8 -6
-4 +9 -3 +9
-2 -3 -8 +6
Press return to continue
Press X return to stop