Overview of this book

C++ is one of the most widely-used programming languages and has applications in a variety of fields, such as gaming, GUI programming, and operating systems, to name a few. Through the years, C++ has evolved into (and remains) one of the top choices for software developers worldwide. This book will show you some notable C++ features and how to implement them to meet your application needs. Each problem is unique and doesn't just test your knowledge of the language; it tests your ability to think out of the box and come up with the best solutions. With varying levels of difficulty, you'll be faced with a wide variety of challenges. And in case you're stumped, you don't have to worry: we've got the best solutions to the problems in the book. So are you up for the challenge?
Preface
Free Chapter
Math Problems
Language Features
Strings and Regular Expressions
Streams and Filesystems
Date and Time
Algorithms and Data Structures
Concurrency
Design Patterns
Data Serialization
Archives, Images, and Databases
Cryptography
Networking and Services
Bibliography
Other Books You May Enjoy

32. Pascal's triangle

Pascal's triangle is a construction representing binomial coefficients. The triangle starts with a row that has a single value of 1. Elements of each row are constructed by summing the numbers above, to the left and right, and treating blank entries as 0. Here is an example of the triangle with five rows:

`        1      1   1    1   2   1  1   3   3   11   4   6   4   1`

To print the triangle, we must:

• Shift the output position to the right with an appropriate number of spaces, so that the top is projected on the middle of the triangle's base.
• Compute each value by summing the above left and right values. A simpler formula is that for a row i and column j, each new value x is...