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
//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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started