Hi guys, I have to make a program for my programming class and I have no idea of how to do it. Can someone help me?
Here's the program that I have to make in C++.
A common memory matching game played by children is to start with a deck of identical pairs face down on a table. A player selects two cards and turns them face up. If they match they remain face up. If they don’t match they are flipped face down. The game continues until all of the cards are face up.
Write a program that plays the memory game. Use 16 cards laid out in a 4 x 4 square and labeled with pairs of numbers from 1 to 8. Your program should allow the player to specify the cards that he or she would like to select through a coordinate system.
For example, suppose the cards are in the following layout:
1 2 3 4
-----------
1 | 8 * * *
2 | * * * *
3 | * 8 * *
4 | * * * *
All of the cards are face down except the pair of 8 which the player found by entering (1,1) and (2,3). To hide cards that have been placed temporarily up, output a large number of blank lines to force the old board off the screen.
Hint: Use a two-dimensional array for the arrangement of cards and another two-dimensional array that indicates if a card is face up of face down. Write a function that “shuffles” the cards in the array by repeatedly selecting two cards at random and swapping them.