include #include #include #include #include #ifdef _WIN32 #include #else #include #endif using namespace std;   void shuffle(string cardTyperr[], int n) {

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

#include <iostream>

#include <bits/stdc++.h>

#include <chrono>

#include <stdlib.h>

#include <cstdlib>

#ifdef _WIN32

#include <Windows.h>

#else

#include <unistd.h>

#endif

using namespace std;

 

void shuffle(string cardTyperr[], int n)

{

unsigned seed = chrono::system_clock::now().time_since_epoch().count();

 

shuffle(cardTyperr, cardTyperr + n, default_random_engine(seed));

 

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

cout << cardTyperr[i] << " ";

cout << endl;

cout << flush;

system ("CLS");

}

 

void playerScore(string playerName[])

{

int player1 = 0;

int player2 = 0;

cout << "Score for PLAYER 1: " << player1 << endl;

cout << "Score for PLAYER 2: " << player2 << endl;

}

 

int main() {

string playerName[2] = {"PLAYER 1", "PLAYER 2"};

 

int cardOrder[8] = {0, 1, 2, 3, 4, 5, 6, 7};

for (int i = 0; i < 8; i++) {

cout << cardOrder[i] << " ";

}

cout << endl;

 

string cardType[8] = {"A", "A", "B", "B", "C", "C", "D", "D"};

for (int i = 0; i < 8; i++) {

cout << cardType[i] << " ";

}

cout << endl;

 

cout << " " << flush;

Sleep(2000);

system ("CLS");

 

int n = sizeof(cardType) / sizeof(cardType[0]);

shuffle(cardType, n);

 

for (int i = 0; i < 8; i++) {

cout << cardOrder[i] << " ";

}

cout << endl;

 

int cardOrderrrSize = *(&cardOrder + 1) - cardOrder;

while (cardOrderrrSize > 0) {

cout << "*" << " ";

cardOrderrrSize -= 1;

}

cout << endl;

 

playerScore(playerName);

 

return 0;

}

What modification should I do in the code above so it run task as mentioned below

2. Track 2 players playing in turn and record their scores.
3. When the cards are flipped in pairs, remove it from the position in display.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY