Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Linear Algebra and the C Language/a0fj

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

__NOTOC__ Install and compile this file in your working directory. /* ------------------------------------ */ /* Save as : c00c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ /* ------------------------------------ */ double **X_rE_mR( double **A, int n, double e /* 1E-1 1E-0 1E+1 */ ) { 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_E(n,e); return(A); } /* ------------------------------------ */ /* ------------------------------------ */ void fun(int r, int c) { double **A = rE_mR(i_mR(r,c), 999, 1E-0); double **B = rE_mR(i_mR(r,c), 999, 1E-1); double **C = rE_mR(i_mR(r,c), 999, 1E-2); double **D = rE_mR(i_mR(r,c), 999, 1E-3); clrscrn(); printf("rE_mR() : Positive and negative decimal numbers\n\n"); printf(" A : xxx rE_mR(A,999,1E-0);"); p_mR(A,S10,P0,C6); printf(" B : xx.x rE_mR(B,999,0.1E-1);"); p_mR(B,S10,P1,C6); stop(); clrscrn(); printf(" C : x.xx rE_mR(C,999,1E-2);"); p_mR(C,S10,P2,C6); printf(" D : x.xxx rE_mR(D,999,1E-3);"); p_mR(D,S10,P3,C6); f_mR(A); f_mR(B); f_mR(C); f_mR(D); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do fun(rp_I(R4),rp_I(C6)); while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Positive and negative decimal numbers: Screen output example: rE_mR() : Positive and negative decimal numbers A : xxx rE_mR(A,999,1E-0); +830 +116 -297 -544 +828 +365 -277 -894 -793 +460 -203 +982 +212 +183 -667 B : xx.x rE_mR(B,999,0.1E-1); +93.7 +90.9 +80.7 +44.0 -99.9 +40.1 -45.5 -84.5 -83.9 +74.3 -92.5 +42.2 -32.6 +45.8 -77.4 Press return to continue. C : x.xx rE_mR(C,999,1E-2); -1.79 -3.41 +2.02 +7.31 -2.18 -6.27 -5.32 -0.14 -8.68 -0.15 +5.90 +9.94 +2.85 -3.63 +5.47 D : x.xxx rE_mR(D,999,1E-3); +0.587 -0.566 -0.251 -0.794 +0.845 -0.151 -0.068 +0.991 -0.778 -0.372 +0.190 +0.170 +0.691 -0.222 -0.916 Press return to continue Press X return to stop