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

  1.         /* General form test program for scientific functions */
  2.  
  3.         /* Routine Tested:  STCRMT  */
  4.  
  5.         main()
  6.  
  7.     {
  8.         int *fp,i,j,k,lcc,lcd,lcv,m,n;
  9.         float v[2][4],c[2][2];
  10.         static float d[5][2]={ 2., 1.,
  11.                                5., 3.,
  12.                                7., 1.,
  13.                               -4.,-2.,
  14.                                2., 3.};
  15.         lcc = 2;
  16.         lcd = 2;
  17.         lcv = 4;
  18.         n = 2;
  19.         m = 5;
  20.  
  21.        stcrmt(lcd,lcv,lcc,n,m,d,v,c);
  22.  
  23.         *fp=fopen("PRN:","w");             /* open the printer */
  24.  
  25.         fprintf(*fp,"Test Results from STCRMT\n");
  26.          printf("Test Results from STCRMT\n\n");
  27.  
  28.         fprintf(*fp," Variable    Mean       Variance   Std Dev\n");
  29.          printf(   " Variable    Mean       Variance   Std Dev\n");
  30.  
  31.        for(i = 0 ; i <= 1; i++)
  32.        {
  33.         for(j = 0; j <= 3 ; j++)
  34.         {
  35.           fprintf(*fp,"%11.6f",v[i][j]);
  36.            printf(   "%11.6f",v[i][j]);
  37.         }
  38.           fprintf(*fp,"\n");
  39.            printf("\n");
  40.        }
  41.  
  42.         fprintf(*fp,"\n Correlation Matrix\n");
  43.          printf(   "\n Correlation Matrix\n");
  44.  
  45.        for(i = 0 ; i <= 1; i++)
  46.        {
  47.         for(j = 0; j <= 1 ; j++)
  48.         {
  49.           fprintf(*fp,"%11.6f",c[i][j]);
  50.            printf(   "%11.6f",c[i][j]);
  51.         }
  52.           fprintf(*fp,"\n");
  53.            printf("\n");
  54.  
  55.        }
  56.      }
  57.  
  58.