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

How do you create this program in c++ language using queues. REDO Project #3 wit

ID: 3806215 • Letter: H

Question


How do you create this program in c++ language using queues. REDO Project #3 with Queues instead of Stacks. Write a C++ program to play the game: 100! Here is how the game is played: 1) There is one deck of 100 cards. Each has a value 0-10. 2) There must be two players 3) Each player draws a card off the "front" of the deck. 4) Here is a list of the #'s and what happens 0 minus 10 points, turn is over 1 -gets the one point and draws again. 2 -gets the 2 points, random card is put at the "back" of the deck, turn is over 3 through 10 the player get the points, but the turn is over 5) First player to 100 wins! (Add another 100 cards, if the deck of cards run out) Must use a queue to represent the deck of cards Must use random function and build the queue using addQueue() function Be sure to include comments Use meaningful identifier names (constants where appropriate) Do not work together; no two people should have identical work!?!? Turn in .cpp file (select the "print' command from bloodshed) Turn in a "print-screen' of your output (press 'print-screen' on keyboard, then 'paste' in MS-Word)

Explanation / Answer

#include #include #include using namespace std; struct queue1 { queue1 *next1; int data1; }*front1 = NULL, *rear1 = NULL, *q1 = NULL, *p1 = NULL, *np1 = NULL; struct queue2 { queue2 *next2; int data2; }*front2 = NULL, *rear2 = NULL, *q2 = NULL, *p2 = NULL, *np2 = NULL; void enqueue1(int x) { np1 = new queue1; np1->data1 = x; np1->next1 = NULL; if (front1 == NULL) { rear1 = np1; rear1->next1 = NULL; front1 = rear1; } else { rear1->next1 = np1; rear1 = np1; rear1->next1 = NULL; } } int dequeue1() { int x; if (front1 == NULL) { coutdata1; delete(q1); return x; } } void enqueue2(int x) { np2 = new queue2; np2->data2 = x; np2->next2 = NULL; if (front2 == NULL) { rear2 = np2; rear2->next2 = NULL; front2=rear2; } else { rear2->next2 = np2; rear2 = np2; rear2->next2 = NULL; } } int dequeue2() { int x; if (front2 == NULL) { coutdata2; delete(q2); return x; } } int main() { int n, x, i = 0; coutn; while (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