Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A common memory matching game played by young children is to start with a deck o

ID: 3543947 • Letter: A

Question

A common memory matching game played by young children is to start with a deck of cards that contain identical pairs. For example, given six cards in the deck, two might be labeled 1, two labeled 2 and two labeled 3. The cards are shuffled and placed face down on a board. A player then selects two cards that are face down, turns them face up, and if the cards match they are left face up. If the two cards do not match, they  are returned to their original face down position. The game continues until all cards are face up.

Write a program that plays the memory matching game. When it start, the program prompts the user for the number of rows and columns for the game board that contains the cards. The total number of cards must be even. Assume that the board dimensions are at most 8 by 9 or 9 by 8. Your cards must be numbered from 1 through (number of rows * number of columns) / 2. Your program allows the player to specify the cards that she would like to select through a coordinate system as shown in the sample run below. All the cards that are face down are indicated by *. For example, in the following layout of a 4 by 4 game board

the pair of 8 which are face up are at coordinates (1,1) and (3,2). Pay attention to how the coordinates are specified: row number followed by column number, both start at index 1, not zero.

Explanation / Answer

// comma.cpp : Defines the entry point for the console application.

//

using namespace std;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote