subject

PROGRAMMING LANGUAGE: C++ Q. No.1:

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 down a C++ program to demonstrate the above-mentioned problem by adding three functions other than main() function:

A) 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.

B) 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

C) 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.

D) 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

//Here is the main function for your help

int main()

{

Card Player1[12]={{D,4},{H,2},{S, A},};

//Incomplete values just to give idea, remaining you have to fill by yourself.

//{D,4} here D is for Diamond type and 4 is the card number in diamond category.

Card Player2[12]={};

Card Player3[12]={};

Card Player4[12]={};

Card Pack[48];

//Call of sort() Function, which sort all 4 player's cards in Pack array. You can assign 'N' as a null in a player array for the card number, if you picked that card and placed in Pack array.

//Call of display() function, which displays all sorted cards placed in Pack array

//Call of findMissing() function

//Call of findMissingFromFile() function

return 0;

}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
Ryan is working on the layout of her web page. she needs to figure out where her header, navigation bar, text, and images should go. what technique can her?
Answers: 1
question
Computers and Technology, 22.06.2019 16:50
Consider a slotted aloha system, where the time slot equals the fixed duration of each packet. assume that there are 4 stations a,b,c,d sharing the medium. (a) stations a,b,c,d receive one packet each from higher layers at times 1.3, 1.5, 2.6,5.7 respectively. show which transmissions take place when, according to the slottedaloha protocol; describe all transmissions until all four packets have been successful.when needed, each station has access to the following sequence of random number, provided by a random number generator and drawn uniformly between 0 and 1: (1) station a draws numbers: 0.31, 0.27, 0.78, 0.9, 0.9, 0.11, 0. (2) station b draws numbers: 0.45, 0.28, 0.11, 0.83, 0.37, 0.22, 0. (3)station c draws numbers: 0.1, 0.2, 0.3, 0.4, 0. (4) station d draws numbers: 0.36, 0.77, 0.9, 0.1, 0.1, 0.1, 0.1, 0. (b) in slotted aloha, a station transmits in each time slot with a given probability. what probabilities would you assign to each of the four stations so as to: (i) maximize the efficiency of the protocol? (ii) maximize fairness among the four stations? (c) will the efficiency increase or decrease if we modify slotted aloha as follows: (i) get rid of slots and allow stations to transmit immediately? (ii) implement carrier sensing? (iii) implement collision detection? (iv) implement collision avoidance?
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
question
Computers and Technology, 23.06.2019 12:40
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
You know the right answer?
PROGRAMMING LANGUAGE: C++ Q. No.1:

Deck of card contains 52 cards in total and catogris...
Questions
question
Mathematics, 30.12.2021 17:40
question
Geography, 30.12.2021 17:50
question
Mathematics, 30.12.2021 17:50
question
Mathematics, 30.12.2021 17:50
Questions on the website: 13722363