home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!ocsmd!mark
- From: mark@ocsmd.ocs.com (Mark Wilson)
- Subject: Re: A different C puzzle
- Message-ID: <C0Dt90.Jyv@ocsmd.ocs.com>
- Sender: news@ocsmd.ocs.com
- Organization: Online Computer Systems, Inc.
- X-Newsreader: Tin 1.1 PL5
- References: <C0DKAx.I8A@cck.coventry.ac.uk>
- Date: Tue, 5 Jan 1993 12:55:46 GMT
- Lines: 57
-
- Alun (champion@cch.coventry.ac.uk) wrote:
- : In article <1992Dec23.185348.19343@sharebase.com> keith@torme.sharebase.com (Keith Chambless) writes:
- : ~In article <1992Dec23.092712.2408@sq.sq.com> msb@sq.sq.com (Mark Brader) writes:
- : ~>> > Write a [C] program that uses every valid character exactly once.
- : ~>> I should think it would be rather difficult to use only one " ...
- : ~
- : ~Best I could come up with is:
- : ~
- : ~#
- : ~
- : ~main()
- : ~{
- : ~ double *ABCDEFGHIJKLMNOPQRSTUVWXYZ[],
- : ~ c_fghjkpqrstvwxyz = -!9 + 8.0 / 7 > 6 < 5 % 4 ? 3 : 2 & 1;
- : ~}
- : ~
- : ~
- : ~missing are ' " \
- :
- : What about ^ | ~
- : Also it doesn't seem to compile - it complains about no size for the array.
- :
- : #
- : double *ABCDEFGHIJKLMNOPQRSTUVWXYZ[],
- : c_fghjkpqrstvwxyz = -!9 ^ +8. / 7 > 6 < 5 % 4 ? 3 : 2 & 1 | ~0;
- :
- : main()
- : { }
- :
- : Sticking the double as global does compile with gcc -ansi and I have added the
- : other operators.
- :
- : I can't see any way of gettting the ' " \ into the program.
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- :
- : -Alun
- :
-
- Wouldn't this work?:
-
- #
- double *ABCDEFGHIJKLMNOPQRSTUVWXYZ[],
- c_fghjkpqrstvwxyz = \
- -!9 ^ +8. / 7 > 6 < 5 % 4 ? 3 : 2 & 1 | ~0;
-
- main()
- { }
-
- =============
- It compiles under gcc. (Would it be OK to indent the "-9!..." line, or
- would that extra TAB be disallowed?)
- --
- -------------------------------------------------------------------------------
- Mark Wilson, Online Computer Systems. 1-800-922-9204 or 1-301-601-2215
- (Try email address mark@wilson.ocs.com....)
- This file .disclaims everything signed with my .signature, I .mean it!
- -------------------------------------------------------------------------------
-