Devry COMP 220 Entire Course DEVRY COMP 220 iLab 1 Two Dimensional Arrays Lab R | Page 2

The card deck is represented by a two-dimensional array of data-type character , where the first dimension represents the suit and the second dimension represents the card in the suit , such as the following . i . char CardDeck [ 4 ][ 13 ]; At the start of each game , each element of the two-dimensional array is initialized to a value of " ", or the " space " character . The deck has four suits , represented by the following dimension indices . . i . ii . iii . Each suit has 13 cards : 2 , 3 , 4 , 5 , 6 , 7 , 8,9 , 10 , jack , queen , king , and ace . Each card in a suit is represented by the following dimension indices . . 2 card i . 3 card ii . 4 card iii . 5 card iv . 6 card v . 7 card vi . 8 card vii . 9 card viii . 10 card ix . jack x . queen xi . king xii . ace All the number cards are worth their face value ( i . e ., a 3 of diamonds is worth 3 ). All face cards are worth 10 . An ace is worth either 1 or 11 . Your final-score calculation must be able to handle this correctly for both the dealer and each player . A random-number generator must be used to select the suit and the card in the suit . . Once a card and suit are selected , the program should check if the value of that array element is a " space ." If the array set the element equal to an integer , identifying the dealer or the player . 1 2 3 4 If the array element ! = " space ," then the random-number and card-checking process should repeat until a " card " or an array element is selected that Once a card is drawn during a game , it cannot be drawn again . When the program first starts , it should prompt the user , asking if he or she wants to play a game of Blackjack or exit the program . If the user inputs to play the game , the next decision should be 1 , 2 , 3 , or 4 players . At the start of the game , the dealer and each player should be dealt two cards . One of the dealer ’ s card ' s value and suit should not be displayed . The number of cards that the dealer will draw during a game should be determined by a random-number generator that will return a value of 0 , 1 , 2 , or 3 cards to be drawn . Each player may then draw a card or hold . If , after drawing a card , any player or the dealer goes over a score of 21 , he or she is not allowed to draw any more cards during the game . Once a player holds , he or she should not be asked to draw a card again during the game . The game continues until one of the following conditions occur : . all players have declared hold ; all players and the dealer have gone over 21 ; a maximum of five cards total are held by any player at the end of a round of card draws ; or any combination of the above . The display should show each player ’ s ( and the dealer ’ s ) hand and update the display after each round of card draws . spades ♠ , clubs ♣ , hearts ♥ , and diamonds ♦ Example Card 1 Card 2 Card 3 Card 4 Card 5 Dealer : ? 10♦