473,799 Members | 2,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accelerated C++ Sample Solutions

I am reading through Koenig and Moo's "Accelerate d 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 7914
Martin <martin.o_brien @[no-spam]which.net> wrote in message
news:3%******** ***********@fe1 2.atl2.webusene t.com...
I am reading through Koenig and Moo's "Accelerate d 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.l earn.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.l earn.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******** *************@f e07.atl2.webuse net.com...
"David White" wrote
This was recently asked in alt.comp.lang.l earn.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.worldn et.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 "Accelerate d 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********@hNo OtSmPaAiMl.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 "Accelerate d 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1438
by: Magic1812 | last post by:
Magic Software invites you to join us this coming Tuesday (January 13th, 2004) at 12:00 EDT / 17:00 GMT for a FREE live Webinar: Title: Accelerated Application Integration and Information Sharing Date: January 13, 2004 Time: 12:00 PM EST / 17:00 GMT Presenter: Lee Sutton
0
1536
by: Magic1812 | last post by:
Magic Software invites you to join us this coming Tuesday (January 13th, 2004) at 12:00 EDT / 17:00 GMT for a FREE live Webinar: Title: Accelerated Application Integration and Information Sharing Date: January 13, 2004 Time: 12:00 PM EST / 17:00 GMT Presenter: Lee Sutton
0
2033
by: Ravindra | last post by:
Well I installed the framework provided by microsoft , the problem is I am able to activate the smart tag in the doc file but when I Click on the Show Detils option in the information bridge the following errors are being dispayed 5:21:26 PM Error Message: OperationInstance: SoapException Stack Trace: Microsoft.InformationBridge.Framework.ExecutionEngine.EngineException: OperationInstance: SoapException --->...
35
7928
by: Markus Dreyer | last post by:
I suggested our Librarian for the University Library to buy Accelerated C++. Practical Programming by Example. by Andrew Koenig and Barbara E. Moo http://www.acceleratedcpp.com/ but she replied saying it might be outdated, since it was published in 2000, and therefore not worth buying. I don't have the book, I just saw a lot of recommendations for it on the web. Do you think it's outdated? Is a new version planned? What is the best...
5
7946
by: Ale | last post by:
Ciao a tutti. Ho eliminato il database di esempio SAMPLE(non cancellato). Ora lo voglio reinstallare ma durante l'installazione mi da il seguente errore: nella finestra con scritto SQL1005N c'è scritto : "Gli alias "SAMPLE" del database già esistono nel catalogo database locale o di sistema. SQL1013N Il nome alias di un database o il nome del database "SAMPLE" non è stato trovato. SQLSTATE=42705.
14
3099
by: Pete | last post by:
Is anyone familiar with this book? Exercise 6-1 of Accelerated C++ asks us to reimplement the frame() and hcat() operations using iterators. I've posted my answers below, but I'm wondering if I'm off track here. First of all, the book has been brisk but reasonable up to chapter 5, and then suddenly, it exploded. I had to grit my teeth to get through chapter 6, but the exercises for chap 6 are pretty tame.
1
2721
by: utab | last post by:
Hi there, I have been reading Accelerated C++ by Andrew Koenig which is an excellent way of learning C++ from even the first pages by using the standard library. One drawback is that no answers to nice exercise sets. Is there anyone who could provide the answers of the exercises in the book? Or an URL will be very much appreciated.
1
1328
by: blangela | last post by:
I am currently teaching 2 part-time (one evening per week) C++ courses using the Deitel & Deitel "C++ How To Program" text. Each course is 13 weeks in length, including time for labs and exams. In earlier posts to this usenet site, people have recommended that I switch texts to "Accelerated C++" by Koenig and Moo. I have just recently received a desk copy of the text from the publisher and I do believe that the approach taken by the...
16
2639
by: Michael Bell | last post by:
I did an the Open University course MT262. I got 3/4 the way through it and only really came unstuck at classes. Following the advice of many, on this list and elsewhere, and impressed by their statement that students were writing substantial programs within a day, I bought "Accelerated C++" by Koenig and Moo. I find I just can't get on with it. I have started at the beginning, and I just can't follow it. The first few chapters do...
0
9543
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10488
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10237
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10029
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7567
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.