In my reference book i studied the sample program in which the problem is that Write a program to randomly shuffle the deck of cards and to deal it out.
Some Facts of Card Games:
There are 4 suits in one deck: Hearts, Spades, Diamonds and Clubs.
Each suit has 13 cards: Ace, Deuce, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen and King.
As obvious from the problem statement, we are dealing with the deck of cards, required to be identified. A card is identified by its suit i.e. it may be one of the Hearts, Spades, Diamonds or Clubs. Also every card has one value in the range starting from Ace to King. So we want to identify them in our program and our requirement is to use English like ‘five of Clubs’. We will declare one array of suit like:
}
It is also mentioned in the book that one can also see the condition inside the ‘while statement, ‘wDeck[ row ][ column ] != 0 ‘. This is to ensure that we don’t overwrite row and column, which has already been occupied by some card. How we can't overwrite row and column which has already been occupied by some card through this conditional statement: ‘wDeck[ row ][ column ] != 0 ‘?