Solution: Lets Play Cards
The solution to the cards coding challenge is provided in this lesson.
We'll cover the following...
We'll cover the following...
Problem 1: Solution
Solution explanation
- Lines 2 and 3:
Since we have to store the value and suit of the card, one of the simplest designs is to use two dchar members.
Problem 2: Solution
Solution explanation
- Line 14:
Our goal is to print the suit shape and value together, so we are using the write function here, which has two parameters: card.suit and card.value.
Problem 3: Solution
Solution explanation
- Lines 17 - 20