Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Write a C++ program that implements the simple card game high/low. At the start, the program prompts the user to enter a number, N, from

Write a C++ program that implements the simple card game high/low.

At the start, the program prompts the user to enter a number, N, from 5 to 50 for the size of the deck, reprompting as needed. The deck contains card labeled 0, 1, 2, ..., N-1.

Use an array of ints to implement the deck. Initially the deck is ordered, with 0 in array index 0, 1 in array index 1, and so on. The program must shuffle the deck by randomly selecting 2 positions in the deck and swapping their contents. Do N swaps to shuffle the deck.

Once the deck is shuffled, the program displays the user's score (initially 0) and the first card from the deck and asks the user if the next card will be higher or lower in value. If the user is correct, one point is added to the users score. If incorrect, a point is deducted from the score. Repeat this process until there are zero or one remaining, at which point the game ends.

All the functions that are used on the deck should be stored in deck.cpp. The actual game code is in main.cpp. You should write a .h file for deck.cpp and a makefile to both compile and clean the project.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions