Question: C++ Write a program to play the Card Guessing Game . Your program must give the user the following choices: To play the game choose

C++

Write a program to play the Card Guessing Game. Your program must give the user the following choices:

To play the game choose one of the following: 1: To guess the face value only. 2: To guess the suit value only. 3: To guess the both the face and suit. 9: To end the game.

Before the start of the game, create a deck of cards (code is provided in starter code).

Before each guess, use the function random_shuffle to randomly shuffle the deck.

On a correct guess, output You won!. On an incorrect guess, output You lose!.

Note: Do not seed random_shuffle

#include

#include

#include

using namespace std;

const string face[] = {"One", "Two", "Three", "Four", "Five",

"Six", "Seven", "Eight","Nine", "Ten",

"Jack", "Queen", "King"};

const string suit[] = {"Spade", "Club", "Diamond", "Heart"};

int main() {

vector deck;

//create the deck of cards

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

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

deck.push_back(face[i] + " of " + suit[j])

//Write program here

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!