How to write simple programs that get input from the user

Assignment Help C/C++ Programming
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

Reference no: EM132295282

Questions Cloud

Banners and handbills and employees have the right : Banners and handbills are. Employees have the right. The NLRA forbids unions:
Explore how to identify and develop high-potential talent : Explore how to identify and develop high-potential talent. Determine the effects of leadership in the management of talent pools and the talent review process.
What were the signs of acute radiation sickness : What were the signs of acute radiation sickness and when and with whom did they begin? What behaviors of the terrorist were clues that they were terrorists?
Discuss the key features of a teachers role as model : Discuss the key features of a teacher's role as model, provider, and facilitator in promoting language learning and literacy.
How to write simple programs that get input from the user : Write a program that simulates playing a simplified version of the game "Candy Land." Demonstrate how to write simple programs that get input from the user
Developing global leaders through membership on global teams : Developing global leaders through membership on global teams. There is a discussion on merger/acquisition for T-Mobile.
Walmart and globalization : A 2004 Frontline documentary on PBS chronicled the rise of Walmart to the global giant it has become.
Which starbucks rewards feature in the mobile app : Which Starbucks Rewards feature in the mobile app is the most valuable to the company?
Create development plan : Create a development plan that explains how you can best build upon your strengths and overcome your challenges to motivate and lead teams.

Reviews

len2295282

4/28/2019 9:42:25 PM

HOW TO SUBMIT YOUR ASSIGNMENT - At the top of every C++ program, you should have at least four lines of documentation: Program name (the C++ file name(s)), Author (your name), Date last updated, and Purpose (a brief description of what the program accomplishes). 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). NOTE: Any assignments missing source code or assignments that do not compile will automatically receive a grade of 0. (You will have 1 week to contact me and revise the assignment for partial credit). Submit only your source code file (*.cpp) Thank you!

Write a Review

C/C++ Programming Questions & Answers

  Implement a solution via semaphores and threads

Implement a solution via semaphores and threads to the n reader 1 writer problem. Fairness always matters. You will accept the number of readers from the command line

  Display the list of all car record

Sales and Profits - show car model, the number of car in stock, car sold, unit cost, selling price and the profit for each car and the total profit for all cars.

  Write a c program to compute dr if f1=50 lb and f2 = 4000

make a program for:A hydraulic lift as shown below from fluid mechanics, it can be shown that a small force F1     acting over a piston of diameter D 1    can be multiplied into a large force   F 2    acting over a piston of diameter D 2  .

  Write a function named sum-from-to that takes two integer

Write a function named "sum_from_to" that takes two integer arguments, call them "first" and "last", and returns as its value the sum of all the integers between first and last inclusive.

  Designing a virtual memory manager

our program is to translate each logical address to a physical address and determine the contents of the signed byte stored at the correct physical address

  Write the definition of the non parameterized constructor

Write the definition of the Non parameterized constructor (constructor1) so that the private member variables are initialized to 0. Write the definition of the parameterized constructor (constructor 2) so that the private member variable x is initial..

  Calculate the total of a purchase from a farmer''s market

You will develop a program that can calculate the total of a purchase from a farmer's market that sells apples, bananas, and oranges. At this particular market, apples are $1.99/lb., bananas are $0.99/lb., and oranges are $1.50/lb. Users should be..

  Write a program to calculates large factorials

Write a driver program to test your modified class Begin with the multiplication operation * added in Exercise.

  Ansi-c program complete assignment as per written in the

complete assignment as per written in the attached

  Create a job class that holds a job id

Create a Job class that holds a Job ID number and the cost of the Job. Include insertion and extraction operators. Create a JobException class that holds a Job and an error message

  Display the appropriate letter grade for the number grade

Execute the script and then input 100, 90, and 100 when prompted for each grade.

  What are the sizes in memory of data types

What are the sizes in memory of other data types in C++? I mean, I know that a double is 8 bytes and an int is 4 bytes. What si the size of a Char and a String?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd