March 2024
Beginner
248 pages
7h 12m
English
This chapter covers
array instead of a vector when we know how many elements we needstd::variantIn this chapter, we will create a deck of cards and write a higher-or-lower card game for guessing whether the next card from a deck is higher or lower. We will create a class for a card and store a deck of cards in an array. We need to consider how to define comparison operators for our cards, as well as how to write constructors and other member functions. We’ll need to use a random shuffle too. We will then extend the game to include jokers and learn how to use std::variant. By the end of the chapter, ...
Read now
Unlock full access