Connecting Tech Pros Worldwide Forums | Help | Site Map

Accelerated C++ Sample Solutions

Martin
Guest
 
Posts: n/a
#1: Jul 19 '05
I am reading through Koenig and Moo's "Accelerated C++" and attempting the
exercises. Are there any sample solutions somewhere? It's all very well me
doing a solution, which seems to work, but for all I know it can be riddled
with undefined behaviours and bad C++. The alternative is to post my
solution to every single exercise and ask for guidance, but I actually think
that is counter-productive and tantamount to spamming anyway. A set of
sample solutions would be ideal. Do they exist?

--
Martin
http://martinobrien.co.uk/




David White
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Accelerated C++ Sample Solutions


Martin <martin.o_brien@[no-spam]which.net> wrote in message
news:3%Wkb.232634$tq.81714@fe12.atl2.webusenet.com ...[color=blue]
> I am reading through Koenig and Moo's "Accelerated C++" and attempting the
> exercises. Are there any sample solutions somewhere? It's all very well me
> doing a solution, which seems to work, but for all I know it can be[/color]
riddled[color=blue]
> with undefined behaviours and bad C++. The alternative is to post my
> solution to every single exercise and ask for guidance, but I actually[/color]
think[color=blue]
> that is counter-productive and tantamount to spamming anyway. A set of
> sample solutions would be ideal. Do they exist?[/color]

This was recently asked in alt.comp.lang.learn.c-c++. The thread is here:
http://tinyurl.com/ro2q

DW



Martin
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Accelerated C++ Sample Solutions


"David White" wrote[color=blue]
> This was recently asked in alt.comp.lang.learn.c-c++. The thread is here:
> http://tinyurl.com/ro2q[/color]

Thanks for that David. It seems from that thread the answer is "no." Shame.

--
Martin
http://martinobrien.co.uk/



Andrew Koenig
Guest
 
Posts: n/a
#4: Jul 19 '05

re: Accelerated C++ Sample Solutions



"Martin" <martin.o_brien@[no-spam]which.net> wrote in message
news:wBilb.315353$Xu6.131513@fe07.atl2.webusenet.c om...
[color=blue]
> "David White" wrote[color=green]
> > This was recently asked in alt.comp.lang.learn.c-c++. The thread is[/color][/color]
here:[color=blue][color=green]
> > http://tinyurl.com/ro2q[/color][/color]
[color=blue]
> Thanks for that David. It seems from that thread the answer is "no."[/color]
Shame.

Indeed it is. However, coming up with a good set of solutions is an
enormous amount of work, because not only must the solutions be exemplary,
but they must be accompanied by explanations of what the decisions were
behind those particular solutions. Perhaps for that reason, the books I
know of that give solutions to the problems in well-known C++ books are
usually written by someone other than the original book's author(s).

Having solutions readily available is not an unalloyed benefit, either. The
problem is that some readers will be tempted to read the solutions rather
than solving the problems on their own.

Still, perhaps it might make sense to consider putting some hints about
particularly interesting questions on the book's website. I'll think about
that.


jeffc
Guest
 
Posts: n/a
#5: Jul 19 '05

re: Accelerated C++ Sample Solutions



"Andrew Koenig" <ark@acm.org> wrote in message
news:1djlb.188455$0v4.14561211@bgtnsc04-news.ops.worldnet.att.net...[color=blue]
>
>
> Having solutions readily available is not an unalloyed benefit, either.[/color]
The[color=blue]
> problem is that some readers will be tempted to read the solutions rather
> than solving the problems on their own.
>
> Still, perhaps it might make sense to consider putting some hints about
> particularly interesting questions on the book's website. I'll think[/color]
about[color=blue]
> that.[/color]

That would be the best of both worlds. Interestingly, there are often
questions here regarding problems to work on. e.g. "I have been programming
for a little while and have written some very simply programs. Can anyone
suggest some 'assignments' for me to try?" That is of course what the
exercises are there for. On the other hand, giving a clue as to what you
had in mind (specifically what features from the chapter you wanted to
exploit or combine, or what points you were referring to) could be very
helpful.


Martin
Guest
 
Posts: n/a
#6: Jul 19 '05

re: Accelerated C++ Sample Solutions


"Andrew Koenig" <ark@acm.org> wrote:[color=blue]
> Indeed it is. However, coming up with a good set of solutions is an
> enormous amount of work, because not only must the solutions be exemplary,
> but they must be accompanied by explanations of what the decisions were
> behind those particular solutions. Perhaps for that reason, the books I
> know of that give solutions to the problems in well-known C++ books are
> usually written by someone other than the original book's author(s).[/color]

Do you mean you set the Exercises without attempting the solutions yourself?
:-) You must have had an idea of what the resulting code would look like.
Some of the Exercises are straightforward and providing answers would be
almost trivial: for example, deciding whether the program is valid or not or
Exercise 0-9 "What's the shortest valid program?" Naturally, there are far
more complex Exercises in the book, and they are probably the ones we're
discussing.

I've tried solutions to the earlier ones in the book, and I honestly don't
know whether they're good, full of undefined behaviours, bad practice, or
what. The fact they compile and produce the correct results doesn't exclude
that of course. I didn't want to post every attempt on here either as it's
tantamount to spamming.

[color=blue]
> Having solutions readily available is not an unalloyed benefit, either.[/color]
The[color=blue]
> problem is that some readers will be tempted to read the solutions rather
> than solving the problems on their own.[/color]

Kernighan & RItchie's "The C Programming Language" had exercises. A set of
solutions was published in Tondo & Gimpel's "The C Answer Book." I found
both books an enormous aid in helping me to learn C.

You're right of course, some people would look at the solutions before
attempting the questions. I wouldn't because I actually want to learn C++.
But there you go...

[color=blue]
> Still, perhaps it might make sense to consider putting some hints about
> particularly interesting questions on the book's website. I'll think[/color]
about[color=blue]
> that.[/color]

That'll certainly be a step in the right direction.

Martin



Paul M. Parks
Guest
 
Posts: n/a
#7: Jul 19 '05

re: Accelerated C++ Sample Solutions


"Martin" <martin.o_brien@[no-spam]which.net> threw a soggy newspaper
against the wall, and here's what stuck:
[color=blue]
> I am reading through Koenig and Moo's "Accelerated C++" and attempting
> the exercises. Are there any sample solutions somewhere? It's all very
> well me doing a solution, which seems to work, but for all I know it
> can be riddled with undefined behaviours and bad C++. The alternative
> is to post my solution to every single exercise and ask for guidance,
> but I actually think that is counter-productive and tantamount to
> spamming anyway. A set of sample solutions would be ideal. Do they
> exist?[/color]

I've begun that task.

http://www.parkscomputing.com/acpp/

PMP
Paul M. Parks
Guest
 
Posts: n/a
#8: Jul 19 '05

re: Accelerated C++ Sample Solutions


"Paul M. Parks" <paulmparks@hNoOtSmPaAiMl.com> threw a soggy newspaper
against the wall, and here's what stuck:
[color=blue]
> "Martin" <martin.o_brien@[no-spam]which.net> threw a soggy newspaper
> against the wall, and here's what stuck:
>[color=green]
>> I am reading through Koenig and Moo's "Accelerated C++" and attempting
>> the exercises. Are there any sample solutions somewhere? It's all very
>> well me doing a solution, which seems to work, but for all I know it
>> can be riddled with undefined behaviours and bad C++. The alternative
>> is to post my solution to every single exercise and ask for guidance,
>> but I actually think that is counter-productive and tantamount to
>> spamming anyway. A set of sample solutions would be ideal. Do they
>> exist?[/color]
>
> I've begun that task.
>
> http://www.parkscomputing.com/acpp/[/color]

By the way, I welcome any suggestions. One that I had recently was to
provide a hint for each exercise *before* the solution.

PMP
Andrew Koenig
Guest
 
Posts: n/a
#9: Jul 19 '05

re: Accelerated C++ Sample Solutions


> Do you mean you set the Exercises without attempting the solutions
yourself?

In general, yes.
[color=blue]
> :-) You must have had an idea of what the resulting code would look like.[/color]

Of course.
[color=blue]
> Some of the Exercises are straightforward and providing answers would be
> almost trivial: for example, deciding whether the program is valid or not[/color]
or[color=blue]
> Exercise 0-9 "What's the shortest valid program?" Naturally, there are far
> more complex Exercises in the book, and they are probably the ones we're
> discussing.[/color]

Right.

In general, there's a big gap between a solution to a problem that's good
from a programming standpoint and one that's good from a teaching
standpoint. Ideally, one would like sample solutions to be ones that, in
addition to being correct, teach something useful to whoever reads them.


Closed Thread