Question
Q.No.1: [3+2+3+4=12 marks] Deck of card contains 52 cards in total and catogrised in 4 different categories named as H eart, D iamond, S pade
Q.No.1: [3+2+3+4=12 marks]
Deck of card contains 52 cards in total and catogrised in 4 different categories named as Heart, Diamond, Spade and Club. Each category contains 13 cards. Each category having cards denomination [2,3,4,5,6,7,8,9,10, J(Jack), Q(Queen), K(King), A(Ace)].
Suppose 4 cards are missing (we are unknown about missing cards) and remaining 48 mixed cards are distributed arbitrarily/randomly to 4 different players. Write a C++ program to demonstrate the above-mentioned problem by adding three functions other than main() function:
- First one is Sort() function which pack all these cards into one packet by arranging them in a sequence of all Spade card comes 1st in asending order, then all Club cards, then all Heart cards and at the end all Diamond cards.
- Second one is displayCards() function which displays all sorted cards achieved in Part-A in the following format:
The Pack Cards are:
Card1: Spade 2
Card2: Spade 3
.
.
Card48: Diamond A
- Third one is findMissing() function which displays the category and number of missing cards in the following format e.g.:
The Missing Cards of 20-Arid-yourNo:
Card1: Spade 4
Card2: Heart J
Card3: Club 10
Card4: Diamond 3
Note: You have to add the screen shot of your output of missing cards.
- Fourth one is findMissingFromFile() function which reads all 48 sorted cards data from file your_Arid_No.txt (assume file is already available with all the sorted data e.g. Spade 2) and find & write missing cards into another file missingCards.txt in the following format:
Card1 Spade 4
Card2 Heart J
Card3 Club 10
Card4 Diamond 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started