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

  1.         /* General form test program for scientific functions */
  2.  
  3.         /* Routine Tested:  SORT2 */
  4.  
  5.         main()
  6.  
  7.         {
  8.         int *fp,i;                           /* utility variables */
  9.  
  10.         int n = 5;
  11.         static float a[5] = {6.1,5.1,4.1,3.1,2.1};
  12.         static float b[5] = {1.0,2.0,3.0,4.0,5.0};
  13.  
  14.         *fp=fopen("PRN:","w");                 /* open the printer */
  15.  
  16.         sort2(a,b,n);                       /* call the function */
  17.  
  18.         fprintf(*fp,"Test Results from function SORT2\n\n");
  19.          printf("Test Results from function SORT2\n\n");
  20.  
  21.         fprintf(*fp,"   a      b\n");       /* label columns */
  22.          printf("   a      b\n");
  23.  
  24.         for (i=0; i<=n-1; i++)              /* print results */
  25.          {
  26.           fprintf(*fp,"%5.1f  %5.1f\n",a[i],b[i]);
  27.            printf("%5.1f  %5.1f\n",a[i],b[i]);
  28.          }
  29.        }
  30.