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

How would I code this in C programming? NOT C++ Just C programming. Also, if pos

ID: 3820171 • Letter: H

Question

How would I code this in C programming? NOT C++ Just C programming. Also, if possible, I would appreciate a screenshot of the code with how it looks compiled to make things easier, and to copy and paste the code text when you reply here. Please also put pseudocode throughout the code so I understand the program well and please complete the task I attached regarding a sequential list of statements in own words that program will need to accomplish the requirements for this code . Thank you and will rate

Write a program that simulates shuffling and dealing a standard deck of 52 cards Task 1: Shuffle the 52 cards: 13 each, Ace through King, of 4 suits (hearts, spades, clubs, and diamonds) Task 2: Ask the user how many cards to deal per hand, and how many players Chands to deal. Example output How many cards per hand? 5 How many s? 4 player Player 1: Four of Hearts Ace of Hearts King of Diamonds Six of Hearts Seven of Clubs Player 2: Three of Hearts Ace of Diamonds Nine of Hearts Nine of Clubs Deuce of Spades Player 3: Deuce of Clubs Three of Diamonds Ten of Hearts Eight of Hearts Deuce of Hearts Player 4: Three of Spades Five of Clubs Jack of Clubs Four of Clubs Ten of Diamonds

Explanation / Answer


#include <iostream>
#include <vector>
#include <ctime>
#include <sstream>

using namespace std;

string suits[4]={"Hearts", "Diamonds", "Spades", "Clubs"};

string faces[12]={"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "Jack", "Queen", "King"};

class Card

{

public:

int face,suit;

Card(int face,int suit)

{

this->face=face;

this->suit=suit;

}

string toString()

{

string nameSuit = suits[suit];

string nameFace = faces[face];

return nameFace+" of "+nameSuit;

}

};

class DeckOfCards

{

private:

vector<Card> deck;

int currentLocation, location;

public:

DeckOfCards()

{

for(int i=0;i<13;i++)

for(int k=0;k<4;k++)

{

Card card(i,k);
deck.push_back(card);

currentLocation++;

}

}

void shuffle()

{

for(int i=0;i<52;i++)

{

location=rand()%52+1;

Card holder=deck[location];

deck[location]=deck[i];

deck[i]=holder;

}

}

void dealCard()

{

while(currentLocation >0)

{

Card returnCard = deck[currentLocation];

returnCard.toString();

currentLocation--;

}

}

bool moreCards()

{

int size = (int) deck.size();

if(size == 0)

return false;

else
return true;
}
};

int main ()
{
DeckOfCards deck;

deck.shuffle();


deck.dealCard();

};

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