subject
Computers and Technology, 09.09.2019 18:10 mari530

Use c++
this assignment is a review of loops. do not use anything more advanced than a loop, such as programmer-defined functions or arrays or classes.
if you know blackjack, you may be tempted to change the specifications below to make the game more "blackjack-like". don't. be sure to follow these specs exactly and don't try to improve on them. you will be penalized if the specs are not met exactly.
in the card game named 'blackjack' players get two cards to start with, and then they are asked whether or not they want more cards. players can continue to take as many cards as they like. their goal is to get as close as possible to a total of 21 without going over. face cards have a value of 10.
write a command line game that plays a simple version of blackjack. the program should generate a random number between 1 and 10 each time the player gets a card. each of the values (1 through 10) must be equally likely. (in other words, this won't be like real black jack where getting a 10 is more likely than getting some other value, because in real black jack all face cards count as 10.) it should keep a running total of the player's cards, and ask the player whether or not it should deal another card. if the player hits 21 exactly, the program should print "congratulations! " and then ask if the player wants to play again. if the player exceeds 21, the program should print "bust" and then ask if the player wants to play again. sample output for the game is written below. your program should produce the same output.
if you'd like a little refresher on random number generation, see lesson 7.3.
> first cards: 3, 2
> total: 5
> do you want another card? (y/n): y
> card: 6
> total: 11
> do you want another card? (y/n): y
> card: 7
> total: 18
> do you want another card? (y/n): n
> would you like to play again? (y/n): y
>
> first cards: 10, 2
> total: 12
> do you want another card? (y/n): y
> card: 6
> total: 18
> do you want another card? (y/n): y
> card: 7
> total: 25
> bust.
> would you like to play again? (y/n): n
suggestion
be sure to use iterative development. start with a small amount of functionality, and then grow it gradually. this way you can compile and run your program after each statement that you write.
you might start by just generating a single card. the program execution might look like this:
> first card: 3
then generate two cards
> first cards: 3, 2
next add a variable to store the total, and a statement to show its value:
> first cards: 3, 2
> total: 5
next read in a user response and print out the value that was entered
> first cards: 3, 2
> total: 5
> do you want another card? (y/n): y
> you entered: y
next you might add a loop, without yet adding the blackjack logic
> first cards: 3, 2
> total: 5
> do you want another card? (y/n): y
> do you want another card? (y/n): y
> do you want another card? (y/n): n
now move the display of the total to the loop
> first cards: 3, 2
> total: 5
> do you want another card? (y/n): y
> total: 5
> do you want another card? (y/n): y
> total: 5
> do you want another card? (y/n): n
your next steps might be something like this:
generate a new card in each loop and display the value
update the total in each loop.
check to see if the user busts in each loop
wrap the game in loop that handles the play-again functionality

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:00, heyitstierney5610
How can data be added in a table by using what view
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, emojigirl2824
Word vocabulary words: print, proofread, status line, graphics, font effects, left margin, justification, line spacing, copy/paste, data. review words: font point, bold, save, center, error. fill in the correct word for the definition and then transfer the letters to the appropriate spot by number. some numbers will be found multiple times. you will end up with a quotation about…… what else? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 k 16 17 18 19 20 21 22 23 24 25 8 27 28 29 w 31 32 k 34 35 36 w h 39 40 41 42 8 44 45 46 47 48 49 50 51 52 53 54 55 .1. a software function that records keystrokes on a disk or drive so information can be 5 4 52 9 later retrieved. p n 2. to produce a paper copy of information. 10 7 12u n 3. a display that shows the location of the cursor, pages, etc. 45 46 18 27 36 20 42p4. pictures or images, located in clip art or other files. 6 24 44 28 34 49 555. any mis-stroke of a key. 47 41 48 2 10 n6. allows major changes to the font such as shadow, emboss, etc. 21 25 46 35 23 21 29 14 22 17 n7. a feature that centers lines of text horizontally. 49 53 46 9 51 p8. size of the font 31 16 22 b l 9. a feature that prints designated text darker than the rest to add emphasis. 32 3 . p10. to compare copy on a display screen or printout to the original 24 39 25 23 54 9 50 3 and correct errors. j un 11. a feature that allows text to be aligned at the left 11 12 7 21 16 49 40 46 34 2 and right margins. leftn 12. amount of blank space on the left side of the paper. 8 18 41 6 34 linen 13. number of blank lines between lines of text. 17 4 49 13 1914. any information inputted into the computer. 3 4 46 44 p /p15. feature that duplicates text from one location and places it in another.
Answers: 2
image
Computers and Technology, 22.06.2019 23:00, maxy7347go
Which factor is the most important when choosing a website host? whether customers will make secure transactions the number of email accounts provided the purpose of the website the quality of the host control panel
Answers: 3
image
Computers and Technology, 24.06.2019 08:00, ineemorehelp
Arah has entered data about football players from team a and team b in a worksheet. she enters names of players from team a with details about each player in different columns of the worksheet. similarly, she enters details of all the players from team b. which option will her view the data for team a and team b in two separate sections after printing? a. page break view b. freeze pane view c. split screen view d. full screen view e. zoom out view
Answers: 1
You know the right answer?
Use c++
this assignment is a review of loops. do not use anything more advanced than a loop,...

Questions in other subjects:

Konu
Mathematics, 11.07.2019 04:30