Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Geoff <geoff@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: King - Chapter 5 date.c |
| Date | 2011-12-20 22:45 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <vhv2f79klqee7fccd6quhvmvb98jma7mtm@4ax.com> (permalink) |
| References | <a77e63e8-c922-4aa0-9fed-2bdde8328d16@18g2000prn.googlegroups.com> <slrnjf25ju.2n2l.usenet-nospam@guild.seebs.net> <c1ca3dab-9675-4269-bd28-53de956598a9@n7g2000prb.googlegroups.com> |
On Tue, 20 Dec 2011 20:50:59 -0800 (PST), flebber
<flebber.crue@gmail.com> wrote:
>On Dec 21, 10:13 am, Seebs <usenet-nos...@seebs.net> wrote:
>> On 2011-12-20, flebber <flebber.c...@gmail.com> wrote:
>>
>> > scanf("%d / %d /%d" &month &day &year);
>>
>> You're missing commas.
>>
>> > case1: case21: case31:
>>
>> You're missing spaces.
>>
>> The problem is that "case 1" is a component of a switch statement, which
>> can be reused in each switch statement, but "case1" is a label, which cannot
>> be reused within the same function.
>>
>> -s
>> --
>> Copyright 2011, all wrongs reversed. Peter Seebach / usenet-nos...@seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
>> I am not speaking for my employer, although they do rent some of my opinions.
>
>And yes playing with the program very easy to break.
>
>Enter the date mm/dd/yyyy: 06/28/2005
>Dated this 28th day of June, 202005.
>
>Enter the date mm/dd/yyyy: 28/06/1974
>Dated this 6th day of , 201974.
>
I don't have a copy of this book. Are you sure it expects a 4-digit
year? Putting a 20 in front of a 2-digit year would only be valid in
that case. It also limits the function to years 2000-2099, hardly a
modern approach.
I also question the lack of a default case in the second switch block.
This is a serious deficiency in a tutorial that is supposed to be
demonstrating "a modern approach" to C.
Is there an online version of this example?
It appears to be K.N. King, "C Programming : A Modern Approach" page
89.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
King - Chapter 5 date.c flebber <flebber.crue@gmail.com> - 2011-12-20 14:50 -0800
Re: King - Chapter 5 date.c Seebs <usenet-nospam@seebs.net> - 2011-12-20 23:13 +0000
Re: King - Chapter 5 date.c flebber <flebber.crue@gmail.com> - 2011-12-20 20:43 -0800
Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-20 22:47 -0800
Re: King - Chapter 5 date.c Seebs <usenet-nospam@seebs.net> - 2011-12-21 08:00 +0000
Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-21 00:22 -0800
Re: King - Chapter 5 date.c Keith Thompson <kst-u@mib.org> - 2011-12-21 03:55 -0800
Re: King - Chapter 5 date.c James Kuyper <jameskuyper@verizon.net> - 2011-12-21 08:22 -0500
Re: King - Chapter 5 date.c flebber <flebber.crue@gmail.com> - 2011-12-20 20:50 -0800
Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-20 22:45 -0800
Re: King - Chapter 5 date.c André Gillibert <MetaEntropy.removeThis@gmail.com> - 2011-12-21 11:35 +0100
Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-21 03:57 -0800
Re: King - Chapter 5 date.c Seebs <usenet-nospam@seebs.net> - 2011-12-21 19:12 +0000
Re: King - Chapter 5 date.c "BartC" <bc@freeuk.com> - 2011-12-21 22:17 +0000
Re: King - Chapter 5 date.c James Kuyper <jameskuyper@verizon.net> - 2011-12-21 18:07 -0500
Re: King - Chapter 5 date.c superpollo <superpollo@tznvy.pbz> - 2011-12-21 14:44 +0100
csiph-web