The Modern C++ Challenge

Book description

Test your C++ programming skills by solving real-world programming problems covered in the book

Key Features

  • [*] Solve a variety of real-world programming and logic problems by leveraging the power of C++17
  • [*] Test your skills in using language features, algorithms, data structures, design patterns, and more
  • [*] Explore areas such as cryptography, communication, and image handling in C++

Book Description

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?

What you will learn

  • [*] Serialize and deserialize JSON and XML data
  • [*] Perform encryption and signing to facilitate secure communication between parties
  • [*] Embed and use SQLite databases in your applications
  • [*] Use threads and asynchronous functions to implement generic purpose parallel algorithms
  • [*] Compress and decompress files to/from a ZIP archive
  • [*] Implement data structures such as circular buffer and priority queue
  • [*] Implement general purpose algorithms as well as algorithms that solve specific problems
  • [*] Create client-server applications that communicate over TCP/IP
  • [*] Consume HTTP REST services
  • [*] Use design patterns to solve real-world problems

Who this book is for

This book will appeal to C++ developers of all levels. There's a challenge inside for everyone.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. The Modern C++ Challenge
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Building the code
        1. How to generate projects for Visual Studio 2017
        2. How to generate projects for Xcode
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Math Problems
    1. Problems
      1. 1. Sum of naturals divisible by 3 and 5
      2. 2. Greatest common divisor
      3. 3. Least common multiple
      4. 4. Largest prime smaller than given number
      5. 5. Sexy prime pairs
      6. 6. Abundant numbers
      7. 7. Amicable numbers
      8. 8. Armstrong numbers
      9. 9. Prime factors of a number
      10. 10. Gray code
      11. 11. Converting numerical values to Roman
      12. 12. Largest Collatz sequence
      13. 13. Computing the value of Pi
      14. 14. Validating ISBNs
    2. Solutions
      1. 1. Sum of naturals divisible by 3 and 5
      2. 2. Greatest common divisor
      3. 3. Least common multiple
      4. 4. Largest prime smaller than given number
      5. 5. Sexy prime pairs
      6. 6. Abundant numbers
      7. 7. Amicable numbers
      8. 8. Armstrong numbers
      9. 9. Prime factors of a number
      10. 10. Gray code
      11. 11. Converting numerical values to Roman
      12. 12. Largest Collatz sequence
      13. 13. Computing the value of Pi
      14. 14. Validating ISBNs
  7. Language Features
    1. Problems
      1. 15. IPv4 data type
      2. 16. Enumerating IPv4 addresses in a range
      3. 17. Creating a 2D array with basic operations
      4. 18. Minimum function with any number of arguments
      5. 19. Adding a range of values to a container
      6. 20. Container any, all, none
      7. 21. System handle wrapper
      8. 22. Literals of various temperature scales
    2. Solutions
      1. 15. IPv4 data type
      2. 16. Enumerating IPv4 addresses in a range
      3. 17. Creating a 2D array with basic operations
      4. 18. Minimum function with any number of arguments
      5. 19. Adding a range of values to a container
      6. 20. Container any, all, none
      7. 21. System handle wrapper
      8. 22. Literals of various temperature scales
  8. Strings and Regular Expressions
    1. Problems
      1. 23. Binary to string conversion
      2. 24. String to binary conversion
      3. 25. Capitalizing an article title
      4. 26. Joining strings together separated by a delimiter
      5. 27. Splitting a string into tokens with a list of possible delimiters
      6. 28. Longest palindromic substring
      7. 29. License plate validation
      8. 30. Extracting URL parts
      9. 31. Transforming dates in strings
    2. Solutions
      1. 23. Binary to string conversion
      2. 24. String to binary conversion
      3. 25. Capitalizing an article title
      4. 26. Joining strings together separated by a delimiter
      5. 27. Splitting a string into tokens with a list of possible delimiters
      6. 28. Longest palindromic substring
      7. 29. License plate validation
      8. 30. Extracting URL parts
      9. 31. Transforming dates in strings
  9. Streams and Filesystems
    1. Problems
      1. 32. Pascal's triangle
      2. 33. Tabular printing of a list of processes
      3. 34. Removing empty lines from a text file
      4. 35. Computing the size of a directory
      5. 36. Deleting files older than a given date
      6. 37. Finding files in a directory that match a regular expression
      7. 38. Temporary log files
    2. Solutions
      1. 32. Pascal's triangle
      2. 33. Tabular printing of a list of processes
      3. 34. Removing empty lines from a text file
      4. 35. Computing the size of a directory
      5. 36. Deleting files older than a given date
      6. 37. Finding files in a directory that match a regular expression
      7. 38. Temporary log files
  10. Date and Time
    1. Problems
      1. 39. Measuring function execution time
      2. 40. Number of days between two dates
      3. 41. Day of the week
      4. 42. Day and week of the year
      5. 43. Meeting time for multiple time zones
      6. 44. Monthly calendar
    2. Solutions
      1. 39. Measuring function execution time
      2. 40. Number of days between two dates
      3. 41. Day of the week
      4. 42. Day and week of the year
      5. 43. Meeting time for multiple time zones
      6. 44. Monthly calendar
  11. Algorithms and Data Structures
    1. Problems
      1. 45. Priority queue
      2. 46. Circular buffer
      3. 47. Double buffer
      4. 48. The most frequent element in a range
      5. 49. Text histogram
      6. 50. Filtering a list of phone numbers
      7. 51. Transforming a list of phone numbers
      8. 52. Generating all the permutations of a string
      9. 53. Average rating of movies
      10. 54. Pairwise algorithm
      11. 55. Zip algorithm
      12. 56. Select algorithm
      13. 57. Sort algorithm
      14. 58. The shortest path between nodes
      15. 59. The Weasel program
      16. 60. The Game of Life
    2. Solutions
      1. 45. Priority queue
      2. 46. Circular buffer
      3. 47. Double buffer
      4. 48. The most frequent element in a range
      5. 49. Text histogram
      6. 50. Filtering a list of phone numbers
      7. 51. Transforming a list of phone numbers
      8. 52. Generating all the permutations of a string
      9. 53. Average rating of movies
      10. 54. Pairwise algorithm
      11. 55. Zip algorithm
      12. 56. Select algorithm
      13. 57. Sort algorithm
      14. 58. The shortest path between nodes
      15. 59. The Weasel program
      16. 60. The Game of Life
  12. Concurrency
    1. Problems
      1. 61. Parallel transform algorithm
      2. 62. Parallel min and max element algorithms using threads
      3. 63. Parallel min and max element algorithms using asynchronous functions
      4. 64. Parallel sort algorithm
      5. 65. Thread-safe logging to the console
      6. 66. Customer service system
    2. Solutions
      1. 61. Parallel transform algorithm
      2. 62. Parallel min and max element algorithms using threads
      3. 63. Parallel min and max element algorithms using asynchronous functions
      4. 64. Parallel sort algorithm
      5. 65. Thread-safe logging to the console
      6. 66. Customer service system
  13. Design Patterns
    1. Problems
      1. 67. Validating passwords
      2. 68. Generating random passwords
      3. 69. Generating social security numbers
      4. 70. Approval system
      5. 71. Observable vector container
      6. 72. Computing order price with discounts
    2. Solutions
      1. 67. Validating passwords
      2. 68. Generating random passwords
      3. 69. Generating social security numbers
      4. 70. Approval system
      5. 71. Observable vector container
      6. 72. Computing order price with discounts
  14. Data Serialization
    1. Problems
      1. 73. Serializing and deserializing data to/from XML
      2. 74. Selecting data from XML using XPath
      3. 75. Serializing data to JSON
      4. 76. Deserializing data from JSON
      5. 77. Printing a list of movies to a PDF
      6. 78. Creating a PDF from a collection of images
    2. Solutions
      1. 73. Serializing and deserializing data to/from XML
      2. 74. Selecting data from XML using XPath
      3. 75. Serializing data to JSON
      4. 76. Deserializing data from JSON
      5. 77. Printing a list of movies to a PDF
      6. 78. Creating a PDF from a collection of images
  15. Archives, Images, and Databases
    1. Problems
      1. 79. Finding files in a ZIP archive
      2. 80. Compressing and decompressing files to/from a ZIP archive
      3. 81. Compressing and decompressing files to/from a ZIP archive with a password
      4. 82. Creating a PNG that represents a national flag
      5. 83. Creating verification text PNG images
      6. 84. EAN-13 barcode generator
      7. 85. Reading movies from an SQLite database
      8. 86. Inserting movies into an SQLite database transactionally
      9. 87. Handling movie images in an SQLite database
    2. Solutions
      1. 79. Finding files in a ZIP archive
      2. 80. Compressing and decompressing files to/from a ZIP archive
      3. 81. Compressing and decompressing files to/from a ZIP archive with password
      4. 82. Creating a PNG that represents a national flag
      5. 83. Creating verification text PNG images
      6. 84. EAN-13 barcode generator
      7. 85. Reading movies from an SQLite database
      8. 86. Inserting movies into an SQLite database
      9. 87. Handling movie images in an SQLite database
  16. Cryptography
    1. Problems
      1. 88. Caesar cipher
      2. 89. Vigenère cipher
      3. 90. Base64 encoding and decoding
      4. 91. Validating user credentials
      5. 92. Computing file hashes
      6. 93. Encrypting and decrypting files
      7. 94. File signing
    2. Solutions
      1. 88. Caesar cipher
      2. 89. Vigenère cipher
      3. 90. Base64 encoding and decoding
      4. 91. Validating user credentials
      5. 92. Computing file hashes
      6. 93. Encrypting and decrypting files
      7. 94. File signing
  17. Networking and Services
    1. Problems
      1. 95. Finding the IP address of a host
      2. 96. Client-server Fizz-Buzz
      3. 97. Bitcoin exchange rates
      4. 98. Fetching emails using IMAP
      5. 99. Translating text to any language
      6. 100. Detecting faces in a picture
    2. Solutions
      1. 95. Finding the IP address of a host
      2. 96. Client-server Fizz-Buzz
      3. 97. Bitcoin exchange rates
      4. 98. Fetching emails using IMAP
      5. 99. Translating text to any language
      6. 100. Detecting faces in a picture
  18. Bibliography
    1. Articles
    2. Library documentation
  19. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: The Modern C++ Challenge
  • Author(s): Marius Bancila
  • Release date: May 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788993869