469,626 Members | 885 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Accelerated C++ Sample Solutions

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/

Jul 19 '05 #1
8 7658
Martin <martin.o_brien@[no-spam]which.net> wrote in message
news:3%*******************@fe12.atl2.webusenet.com ...
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?


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

DW

Jul 19 '05 #2
"David White" wrote
This was recently asked in alt.comp.lang.learn.c-c++. The thread is here:
http://tinyurl.com/ro2q


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

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

Jul 19 '05 #3

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

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.
Jul 19 '05 #4

"Andrew Koenig" <ar*@acm.org> wrote in message
news:1d***********************@bgtnsc04-news.ops.worldnet.att.net...


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.


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.
Jul 19 '05 #5
"Andrew Koenig" <ar*@acm.org> wrote:
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).
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.

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.
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...

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.


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

Martin

Jul 19 '05 #6
"Martin" <martin.o_brien@[no-spam]which.net> threw a soggy newspaper
against the wall, and here's what stuck:
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?


I've begun that task.

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

PMP
Jul 19 '05 #7
"Paul M. Parks" <pa********@hNoOtSmPaAiMl.com> threw a soggy newspaper
against the wall, and here's what stuck:
"Martin" <martin.o_brien@[no-spam]which.net> threw a soggy newspaper
against the wall, and here's what stuck:
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?


I've begun that task.

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


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

PMP
Jul 19 '05 #8
> Do you mean you set the Exercises without attempting the solutions
yourself?

In general, yes.
:-) You must have had an idea of what the resulting code would look like.
Of course.
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.


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.
Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

35 posts views Thread by Markus Dreyer | last post: by
5 posts views Thread by Ale | last post: by
14 posts views Thread by Pete | last post: by
1 post views Thread by utab | last post: by
16 posts views Thread by Michael Bell | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.