home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-SSP.ARJ / MATTRS.TST < prev    next >
Encoding:
Text File  |  1984-08-31  |  1.1 KB  |  51 lines

  1.         /* General form test program for scientific functions */
  2.  
  3.         /* Routine Tested:  MATTRS */
  4.  
  5.         main()
  6.  
  7.         {
  8.         int llr,n;
  9.         static float x[4]={ 1., 0.,
  10.                             1., 0.
  11.                           };
  12.  
  13.  
  14.         n =  2;
  15.         llr= 2;
  16.  
  17.         mattrs(n,llr,x);                    /* call the function */
  18.         printr(x,n,n);                      /* print the result  */
  19.  
  20.         }
  21.  
  22.                 /* Routine to print matrices */
  23.  
  24.       printr(a,nrow,ncol)
  25.  
  26.         int nrow,ncol;
  27.         float a[];
  28.  
  29.       {
  30.         int *fp,j,k,ne;
  31.  
  32.         ne=ncol-1;
  33.  
  34.         *fp=fopen("PRN:","w");                 /* open the printer */
  35.  
  36.         fprintf(*fp,"Test Results from MATTRS\n\n");
  37.          printf("Test Results from MATTRS\n\n");
  38.  
  39.         for(j = 0; j <= nrow-1 ; j++)
  40.          {
  41.           for(k = j*ncol; k <= j*ncol+ne ; k++)
  42.            {
  43.             fprintf(*fp,"%4.1f  ",a[k]);
  44.              printf("%4.1f  ",a[k]);
  45.            };
  46.            fprintf(*fp,"\n");
  47.             printf("\n");
  48.          }
  49.        }
  50.  
  51.