home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 19005 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.4 KB  |  61 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!udel!gvls1!jabber!cpp!root
  3. From: root@cpp.uucp (Rich Bauer)
  4. Subject: FP formats not linked
  5. Organization: Critical Path Project
  6. Date: Wed, 30 Dec 1992 02:35:47 GMT
  7. Message-ID: <1992Dec30.023547.1076@cpp.uucp>
  8. Lines: 51
  9.  
  10. When scanf goes to get the first batting average in this program,
  11. the program terminates abnormally with the error message:
  12. "floating point formats not linked"
  13.  
  14. What does this mean?  I can't find it in the manuals, and the code
  15. is correct as far as I can tell.  What's the problem?
  16.  
  17. ----------------------------------------------------------------------
  18.  
  19. #include <stdio.h>
  20.  
  21. void main(void)
  22. {
  23.     char name[9] [80];
  24.     double b_avg[9];
  25.     int i, h, l;
  26.  
  27.     double high, low, team_avg;
  28.  
  29.     for(i=0;i<9;i++) {
  30.       printf("Enter name %d: ", i+1);
  31.       scanf("%s",name[i]);
  32.       printf("Enter batting average: ");
  33.       scanf("%lf", &b_avg[i]);
  34.       printf("\n");
  35.     }
  36.     high=0.0;
  37.     low=1000.0;
  38.     team_avg=0.0;
  39.     for(i=0;i<9;i++) {
  40.       if(b_avg[i]>high) {
  41.       h=i;
  42.       high=b_avg[i];
  43.       }
  44.       if(b_avg[i]<low) {
  45.       l=i;
  46.       low=b_avg[i];
  47.       }
  48.       team_avg=team_avg+b_avg[i];
  49.     }
  50.  
  51.     printf("The high is %s %lf\n",name[h],b_avg[h]);
  52.     printf("The low is %s %lf\n",name[l],b_avg[l]);
  53.     printf("The team average is %lf",team_avg/9.0);
  54. }
  55.  
  56.  
  57. -- 
  58. Rich Bauer              |    UUCP...!dsinc!jabber!cpp!rich
  59. Critical Path Project Inc  |    or.....rich@cpp.UUCP
  60. Philadelphia PA            |    Public Access, News & Mail 
  61.