Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

So I need help with this program. Thank you for your help and please read and fo

ID: 3885451 • Letter: S

Question

So I need help with this program. Thank you for your help and please read and follow the directions. Thanks, You are a lifesaver. The sooner it is done the better, But don't feel like you have rush through it. Thanks!

Here is the directions given to us. The two executables take two optional arguments:-seed-N where N is a non- negative integer for seeding the random number generator, and-verbose causes the random_card() function to print each card to stdout before returning it to the calling function. Make hw1a.cpp Generate suit cards randomly until all face cards of a suit type has been generated. Next print a table showing how many cards of each suit and rank you were dealt along the way. Flag the suit that caused termination by adding"*" at the end its output line. The first step is to work on how to parse the String representing a card into suit and rank and translate those into the indices for the corresponding global string arrays. That is, reverse engineer what the random_card() function does. Caveat: Do not simply use integer division to reverse the modulo arithmetic, instead use string comparisons. Test the code by temporarily printing the suit and rank indices to stdout Break out of the loop after some small number of iterations. The next step is to add a table that keeps track of which cards you are dealt (counts of suit and rank pairs). Implement this table using a static two-dimensional whose content you initialize to zero before entering the while loop. The table should have 4 rows and 13 columns corresponding to the fixed number of suits and the number of ranks, respectively Lastly, replace the finite number of iterations termination criterion with the one requested which is based on all face cards having been seen for a given suit. That is, step thru the table for each suit and set a

Explanation / Answer

#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

struct card

{

int value;

char suite;

};

card Deck [52];

void sortedDeck()

{

int i = 1;

int valueCounter = 1;

while (i <= 13)

{

Deck[i].suite = 'c';

Deck[i].value = valueCounter;

valueCounter++;

i++;

}

valueCounter = 1;

while (i <= 26)

{

Deck[i].suite = 'd';

Deck[i].value = valueCounter;

valueCounter++;

i++;

}

valueCounter = 1;

while (i <= 39)

{

Deck[i].suite = 'h';

Deck[i].value = valueCounter;

valueCounter++;

i++;

}

valueCounter = 1;

while (i <= 52)

{

Deck[i].suite = 's';

Deck[i].value = valueCounter;

valueCounter++;

i++;

}

}

int temp;

card cardPulled;

void pullRandomCard()

{

srand ((unsigned)time(0));

while(true)

{

temp = rand() % 52+1;

if (Deck[temp].value != 0)

{

cardPulled.suite = Deck[temp].suite;

cardPulled.value = Deck[temp].value;

Deck[temp].suite = NULL;

Deck[temp].value = 0;

break;

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote