00:01
In this question, we have to write a code in c++.
00:07
So, here we have two classes that are there.
00:13
That is card and one is deck.
00:18
So, the card class over here, it will represent a single playing card with a suit and a rank.
00:29
And the deck class over here, it will represent a deck of playing cards and provide methods to initialize the deck and perform a perfect shuffle.
00:38
Print the deck, compare the two decks and find the number of perfect shuffles required to return the deck to its original configuration.
00:47
So, our question will be between these two main classes only.
00:55
And to compile and run the code, we have to save each file with the specified names and then use the c+ + compiler to build it.
01:04
So, by using the gcc compiler, we can see that we have to write this line to run the program.
01:19
Main .cpp and .cpp card .cpp so cardgame so, as you can see here, this is what the line is.
01:48
And we will see how to write this code in the basic c+ + compiler.
01:57
So, firstly, we will be including certain header files that are used for basic input -output functions and the card functions.
02:06
So, after doing that, we will start with the basic things that we have.
02:15
We will enumerate what we have in basic card, that is the clubs, diamonds, hearts, spades.
02:22
Then there are ranks.
02:24
So, these are the numbers that are there up to 10.
02:27
And then we have, as you know, jack, queen and king and rank as the further rank in the playing cards.
02:39
So, once this is done, now we will be adding the class card that is there.
02:49
So, this will contain the suit and the rank like this.
02:55
Now, the next step that we will be doing is we will be having a public class which will take the parameters as suit s and rank r.
03:08
So, we will have a class card over here like this.
03:13
So, as you can see, this is a card h that we have given.
03:17
So, this card will represent a single playing card.
03:21
So, it has private member variables that is suit and rank of type suit and rank respectively.
03:32
So, the card class has a constructor here that takes the suit and rank as parameters and initializes the member variables.
03:40
So, it will provide the getter methods now.
03:45
So, for that, we will just include the methods ahead.
03:50
It is a simple way to give us the get rank method that we are using.
04:01
So, here as you can see, this will provide the getter methods that is get suit and get rank.
04:08
So, why this is done? this is done to access the suit and rank of a card that we have just defined previously.
04:17
So, it will return suit and rank.
04:19
Now, the class also provides the utility methods that is get suit string...