home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19242 < prev    next >
Encoding:
Text File  |  1993-01-05  |  2.0 KB  |  70 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ocsmd!mark
  3. From: mark@ocsmd.ocs.com (Mark Wilson)
  4. Subject: Re: A different C puzzle
  5. Message-ID: <C0Dt90.Jyv@ocsmd.ocs.com>
  6. Sender: news@ocsmd.ocs.com
  7. Organization: Online Computer Systems, Inc.
  8. X-Newsreader: Tin 1.1 PL5
  9. References: <C0DKAx.I8A@cck.coventry.ac.uk>
  10. Date: Tue, 5 Jan 1993 12:55:46 GMT
  11. Lines: 57
  12.  
  13. Alun (champion@cch.coventry.ac.uk) wrote:
  14. : In article <1992Dec23.185348.19343@sharebase.com> keith@torme.sharebase.com (Keith Chambless) writes:
  15. : ~In article <1992Dec23.092712.2408@sq.sq.com> msb@sq.sq.com (Mark Brader) writes:
  16. : ~>> > Write a [C] program that uses every valid character exactly once.
  17. : ~>> I should think it would be rather difficult to use only one " ...
  18. : ~
  19. : ~Best I could come up with is:
  20. : ~
  21. : ~#
  22. : ~
  23. : ~main()
  24. : ~{
  25. : ~    double *ABCDEFGHIJKLMNOPQRSTUVWXYZ[],
  26. : ~           c_fghjkpqrstvwxyz = -!9 + 8.0 / 7 > 6 < 5 % 4 ? 3 : 2 & 1;
  27. : ~}
  28. : ~
  29. : ~
  30. : ~missing are ' " \
  31. : What about ^ | ~
  32. : Also it doesn't seem to compile - it complains about no size for the array.
  33. : #
  34. : double *ABCDEFGHIJKLMNOPQRSTUVWXYZ[],
  35. :        c_fghjkpqrstvwxyz = -!9 ^ +8. / 7 > 6 < 5 % 4 ? 3 : 2 & 1 | ~0;
  36. : main()
  37. : { }
  38. : Sticking the double as global does compile with gcc -ansi and I have added the
  39. : other operators.
  40. : I can't see any way of gettting the ' " \ into the program.
  41.         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  42. :   -Alun
  43. :
  44.    
  45. Wouldn't this work?:
  46.  
  47. #
  48. double *ABCDEFGHIJKLMNOPQRSTUVWXYZ[],
  49.        c_fghjkpqrstvwxyz = \
  50. -!9 ^ +8. / 7 > 6 < 5 % 4 ? 3 : 2 & 1 | ~0;
  51.  
  52. main()
  53. { }
  54.  
  55. =============
  56. It compiles under gcc.  (Would it be OK to indent the "-9!..." line, or
  57. would that extra TAB be disallowed?)
  58. --
  59. -------------------------------------------------------------------------------
  60. Mark Wilson, Online Computer Systems.  1-800-922-9204 or 1-301-601-2215
  61. (Try email address mark@wilson.ocs.com....)
  62. This file .disclaims everything signed with my .signature, I .mean it!
  63. -------------------------------------------------------------------------------
  64.