Article View: comp.std.c
Article #2883A small programming challenge.
From: Kevin Pollard
Date: Wed, 15 May 1991 01:43
Date: Wed, 15 May 1991 01:43
29 lines
1602 bytes
1602 bytes
I have written some code to accept command line parameters and apply meaningful parameters - but I feel it is an interesting problem which must have some neat solutions. The task is: allow up to 4 parameters to be entered on the command line (that is, progname [ p1 [ p2 [ p3 [ p4 ] ] ] ] if you know what I mean) The program is to accept the parameters. If the a parameter is missing then it is to default to the parameter is to default to the one before it. (that is, if progname x y z is entered, then the 4th parameter is to default to z) and so on down to the first parameter which is to have a hard coded default. If no parameters were entered then all parmeters would end up defaulting to this hard coded default. Does anyone out there know of some neat ways of doing this. This is really an algorithm problem, but since there is no algorithm newsgroup, and I program in C on an IBM-type machine, this would be a relevant newsgroup. -- Kevin Pollard Internet: kevin@loki.une.oz.au University of NewEngland Northern Rivers Phone: +61 (066) 203694 Lismore NSW Australia "My brain hurts"
Technical Details
Message-ID:
<1499@loki.une.oz.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!metro!grivel!loki!kevinShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!metro!grivel!loki!kevin From: kevin@loki.une.oz.au (Kevin Pollard) Newsgroups: comp.std.c,comp.sys.ibm.pc.programmer Subject: A small programming challenge. Keywords: Algorithm Message-ID: <1499@loki.une.oz.au> Date: 15 May 91 01:43:59 GMT Followup-To: comp.std.c Organization: University of NewEngland, Northern Rivers (Lismore) Lines: 29