home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13420 < prev    next >
Encoding:
Text File  |  1992-09-09  |  2.3 KB  |  57 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!psinntp!isc-newsserver!gmr6139
  3. From: gmr6139@ultb.isc.rit.edu (G.M. Richard )
  4. Subject: Float Variables (was Re: Help!!!...)   
  5. Message-ID: <1992Sep9.134604.16558@ultb.isc.rit.edu>
  6. Originator: gmr6139@ultb
  7. Sender: news@ultb.isc.rit.edu (USENET News System)
  8. Nntp-Posting-Host: ultb-gw.isc.rit.edu
  9. Organization: Rochester Institute of Technology
  10. References: <1992Sep8.002536.18118@ultb.isc.rit.edu> <fdhC028W20DL01@JUTS.ccc.amdahl.com>
  11. Date: Wed, 9 Sep 1992 13:46:04 GMT
  12. Lines: 43
  13.  
  14. In article <fdhC028W20DL01@JUTS.ccc.amdahl.com> tpa10@JUTS.ccc.amdahl.com (Thomas P. Anderson) writes:
  15. >In article <1992Sep8.002536.18118@ultb.isc.rit.edu> gmr6139@ultb.isc.rit.edu (G.M. Richard ) writes:
  16. >>I can't get my compiler to do float-type variables.  I can do 
  17. >>... (some deleted) ...  this program with Turbo C, all I get
  18. >>is zeroes for floats.  Take a look:
  19. >> 
  20. >>/*  Variable Example */
  21. >>#include <stdio.h>
  22. >>#define apples  4
  23. >>#define oranges 3.6
  24. >>main()
  25. >>{
  26. >>        printf("\nApples = %d\nOranges = %f", apples, oranges);
  27. >>}
  28. >>output:
  29. >>Apples=4
  30. >>Oranges=0.000000           
  31. >> ... (more deleted)
  32. >I'm suprised you didn't get any warnings from TC.  Try "#include"ing
  33. >float.h.  Also, did you install the floating point libraries, and/or
  34. >does your link command include them?  Just for grins add lines to
  35. >declare a float variable and try and do some math on it, I bet the
  36. >linker chokes on you.
  37. >
  38. >Tom A.
  39.  
  40. Thanks for all the responses, mostly through private mail, but I tried
  41. all the suggestions and none of them worked.  I'm not getting any error
  42. messages, and I have tried using regular floats and math, every which
  43. way possible, without writing a book.  I believe I am using an old
  44. version (it.s Turbo C, not Turbo C++) but it's all I can fit on my
  45. computer ('286 w/ 640 k).  I'm thinking about actually buying a
  46. compiler, but when I get a -real- computer, I hope to use Borland C++.
  47. $80 seems like a waste if I won't use it after one year...
  48.  
  49. Forever Baffled,
  50.  
  51.  
  52. -- 
  53.   _  _                __                         gmr6139@ultb.isc.rit.edu
  54.  /| /|  __  _/__/_   /__) ' __  /_  __ ,_  __/  gmr6139@george.cs.rit.edu
  55. / |/ |_/-/__/__/____/ \__/_/___/ /_/-/_/__/_/  gmr6139@ritvax.isc.rit.edu
  56. ____________________________________________  gmr6139@ritlav.isc.rit.edu
  57.