Reference no: EM132295282
Assignment -
INTRODUCTION: In this assignment, you will demonstrate how to write simple programs that get input from the user, produce output, perform simple calculations, make decisions, perform iteration/repetition, and create arrays.
ASSIGNMENT: Candy Land
Write a program that simulates playing a simplified version of the game "Candy Land." In "Candy Land" players take turns drawing cards that have a colored square on them. The player then travels on the board according to the color on the card. The first person to reach the end of the board wins.
In this version, we will practice using arrays and enums. We will use an array of ints to represent the players of the game. You should have an int array of size 4, then you will prompt the user for the number of players from 2 - 4 and this will determine how much of the array you will use. You will create an enum type CARD. The values of the enum will be the possible color of the card. Value 0 should represent an empty deck, and you should have 6 colors (RED, PINK, BLUE, GREEN, YELLOW, ORANGE).
To draw a card you will read a number from cards.txt. Write a function that takes an ifstream as an input parameter and returns a CARD. Read a number from the file and convert the number to a variable of the CARD type.
After prompting for the number of players use a loop to draw cards for each player. After drawing a card, move the player by adding the card value to the player total. The game will end either when a player reaches 20 or there are no more cards (input file reaches the end). The winner is the first player to have a score of 20 or more, or the player with the most points after all the cards have been drawn.
The program should output for each player's turn the current player, the card they drew, how many spaces they move, and their location after moving (total score).
Attachment:- Assignment Files.rar