Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 01: Memory Game (30 points) Children often play a memory game in which a deck of cards containing matching pairs is us The cards

image text in transcribed
Problem 01: Memory Game (30 points) Children often play a memory game in which a deck of cards containing matching pairs is us The cards are shuffled and placed face down on a table. The players then take tums two cards at a time. If both cards match, they are left face up; otherwise, the cards are placed face ed down at the same match, then they can memorize The the players see the selected pair of cards and if the cards do not the cards and use their memory to select the next pair of cards match, then theye o game continues until all the cards are face up. Write a program to play the memory game Use a two-dimensional array of 4 rows and 4 columns for a deck of 16 cards with 8 maiching pairs. You can use numbers 1 to 8 to mark the cards. Use random number generators to randomty store the pairs in the array. Use appropriate functions in your program, and the main program should be merely a call to functions Sample Output for Problem 01 of the oi nter the row (1 to 4) and ee>(1 to 4).position of the pair (1 to 4) position of the pair: 3 Pair match Enter the row (1 to 4) and col C1 to 4) position of the pair: 1 2 nter the row C1 to 4) and col C1 to 4) position of the pair: 44 Pair do not match. select again Enter the row (1 to 4) and col (l to position of the pair: 73 nvalid position nter the row to 4 and col (1 to position of the pair: 2 2 ard at, this position already faced up. Select position again nter the row (i to 4) and col (i to 4) position of the pair: 7 166 2 8 S 3 385 air match 7 166 28S 3 385 ress any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions