Main Page

From CppPrimer

Jump to: navigation, search

UPDATE: The 4th edition of C++ Primer is now 7 years old. A lot has changed in C++ since the time the book was written and some of its suggestions are now decidedly the wrong way to do things in modern C++. The 5th edition of the book is set to release on August 20th, 2012. While I have no knowledge about the new edition it is likely a much better choice for those wishing to learn C++ today. If you have the 5th edition and would like to contribute to updating this wiki please contact me (webmaster '@' jesseolmer.com) and we can come up with a new way to navigate the site that allows 4th and 5th edition content. --c0uchm0nster 15:11, 19 July 2012 (UTC)

This site provides answers to the exercises in C++ Primer 4th Edition by Stanley Lippman.

There is an answer book available for the 3rd edition, but that's obviously not of much help for those of us with the 4th. The 4th edition of the book brings us a full update to be compatible with the STL.

You can obtain a copy of this book from . I've read more than five beginner/intermediate C++ books and I like this one the most (albeit it might have a slightly steeper learning curve than other books for someone with no programming experience, but the order and way information is presented is definitely the best I've seen to give a full understanding of mechanics of programs in the more advanced parts).

Contents

Editing / Contributing

Editing Info

For those of you who want to be able to add/edit content in this wiki feel free to create an account for yourself and start editing. If you're not familiar with MediaWiki syntax, refer to the official editing reference page [1]

Please also note that a new wiki extension has been installed which allows syntax highlighting. Simply surround your code in <source lang="cpp"> and </source>.

Etiquette

Given the nature of programming there is usually more than one way to solve a problem. If you are going to contribute to this wiki keep in mind that there (usually) is no right way - so don't rewrite someone elses example with your own, instead create a new page with your code, and link to that page in the exercise section it refers to.

Also note that diff is not installed, so if you make any corrections to someone elses code, make sure you provide some way for others to know what you changed (in the revision summary for example).

Work In Progress

Please keep in mind, in addition to a wiki always being under construction I am also in the process of converting the answers from exercise sections 1-7 from a different wiki format to the MediaWiki syntax. This will take some time, so bear with me, and feel free to post in discussion about any errors you find.

Get Help

C++ Help

If you're having trouble with an exercise or concept feel free to post in the appropriate article's discussion section. You do not need an account to post in discussion. Keep in mind that most non-code non-language related questions (such as IDE questions) probably won't be answered. In which case Google is your friend.

How to get Help

When you need help figuring out why your code won't work make sure to provide the code, and the error message (if any) you receive, as well as any other information that may be useful such as compiler output. Also consider leaving a name/nickname with your post.

The Answers

Chapter 1

Chapter 2

Pre 2.3.6 Note

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

Chapter 12

Chapter 13

Chapter 14

Chapter 15

Chapter 16

Chapter 17

Chapter 18

Personal tools