C Programming: Get Random Playing Card and Shuffle a Deck of Playing Cards Can you help me with coding these two problems? Thank you. This is main.c file #include #include #include #include #include...


C Programming: Get Random Playing Card and Shuffle a Deck of Playing Cards


Can you help me with coding these two problems? Thank you.



This is main.c file


#include


#include


#include


#include


#include "playingCard.h"

int main( int argc, char *argv[] )

{

//TODO: CORE PROBLEM

//Your core problem should implement the getRandomCard function

// Uncomment the two lines below and implement your the getRandomCard function



// PlayingCard card = getRandomCard();

// displayCard(card)

//TODO: ADDITIONAL CHALLENGE PROBLEM

// The challenge problem implements the shuffle deck function

// Uncomment the three lines below and implement the shuffleDeck function

//PlayingCard shuffled_deck[52];

//shuffleDeck( shuffled_deck );

//displayCardDeck(shuffled_deck);

return 0;

}


This is playingCard.c file


#include


#include


#include


#include


#include


#include "playingCard.h"


char validValues[13] = {'2', '3','4','5','6','7','8','9','T','J','Q','K','A'};


char *validSuits[4] = {"SPADES", "DIAMONDS", "HEARTS", "CLUBS"};


void displayCard(PlayingCard card)


{


printf("%c of %s\n", card.value, card.suit);


}


void displayCardDeck( PlayingCard deck[] )


{


printf("------------------\n");


int i;


for(i=0;i


displayCard(deck[i]);


}


This is playingCard.h file


#ifndef PLAYINGCARD_H

#define PLAYINGCARD_H

typedef struct card {

char value;

char suit[16];

} PlayingCard;

void displayCard(PlayingCard card);

void displayCardDeck( PlayingCard deck[] );

#endif


May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here