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

Given a deck of poker cards, and 4 players. Use C++ class to implement an intege

ID: 3611708 • Letter: G

Question

Given a deck of poker cards, and 4 players. Use C++ class to implement an integer Stack for storing the 52 cards, along with related pop, push, isEmpty, isFull functions. To make sure the cards are well suffled, the srand() and rand() functions should be exercised to randomly choose cards, and push them into Stack one by one. The poker game stalls by dealing cards to the 4 players in a circular manner (popping cards from the top of Stack one by one). Each player should receive 5 cards. Write a C++ program to simulate this simple card dealing process, and display the result. Sample Output: [Hint] ASCII codes of heart, diamond, club and spade are 3, 4, 5, and 6, respectively. Given a deck of poker cards, and 4 players Use C++ class to implement an integer stack for storing the 52 cards To make sure the cards are well shuffled and push them into stack one by one The poker game starts by dealing cards to the 4 players in a circular manner Each player should receive 5 cards Output Class declaration for the stack Random number generator

Explanation / Answer

#include #include #include enum { EMPTY = -1 };using namespace std;class stack {public:stack(){max_len=52;s = new int[max_len];top=EMPTY;;}~stack() { delete []s; }void reset() { top = EMPTY; }void push(int c) { s[++top] = c; }int pop() { return s[top--]; }int top_of()const { return s[top]; }bool empty()const { return top == EMPTY;}bool full()const { return top == max_len - 1;}private:int *s;int max_len;int top;};int main(){stack s; int i,j;int card[52],num,print;for(i=0;i
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