Write a program to execute the game craps

Assignment Help Computer Engineering
Reference no: EM132196225

Write a C++ program to execute the game craps. Rules for the game are below and instructions for the code are afterward.

A player rolls two six-sided die, which means he can roll a 1, 2, 3, 4, 5 or 6 on either die. After the dice come to rest they are added together and their sum determines the outcome. If the sum is 7 or 11 on the first roll, the player wins. If the sum is 2, 3, or 12 on the first roll, the player loses (this is called "craps").

If the player rolls 4, 5, 6, 8, 9, or 10 on the first throw, then that becomes the player's "point". To win, the player must "make their point", that means that they must roll the sum they got on that first throw, so they keep rolling the dice. The player loses by rolling a 7 before making the point.

Write a C++ program that simulates the playing of this game with two players. Your program must have output like that seen below, your actual results will be different due to using random numbers. You will need:

An introduction for your program with instructions and your name.

The players are prompted for a random number seed.

A function that generates the random numbers and prints the results to the interface. Two separate random numbers must be generated for the two die, not the sum. This function returns the toss of one die after the user is prompted to tap the spacebar or any other key.

The program alternates players rolling the die.

The program keeps track of the number of wins for each player.

The program tells the users if player 1 or 2 wins after 3 points are won.

Write the output to a file.

Please make sure to read the instructions carefully. The game is between 2 players. If they roll a 7 or 11 on their first roll, they win. If they roll a 2, 3, or 12 on their first roll, they lose. Any other number rolled on the first roll becomes the number that needs to be summed by either of the 2 players.

The players take turns rolling for that number. If either player rolls a 7 afterward, they lose. If they roll the number that needs to be summed, they gain a point. 3 points and they win. However, if they roll a 7 during this period, they lose. They take turns.

Reference no: EM132196225

Questions Cloud

Create a file with your own name : Create a file with your own name. Store the followinh information on the created file
What is the largest discount given to a product beingordered : Discuss various rationales for organizations to use Big Data Analytics. Please search for two organizations online and explain their motivations
Write down a c program to generate a matrix : Write down a C program to generate a matrix (2-D Array) of integers in the range 1 to 100.
Write a c program that initializes an integer array : Write a C program that initializes an integer array, and two scalar values a and b.
Write a program to execute the game craps : Write a C++ program to execute the game craps. Rules for the game are below and instructions for the code are afterward.
Write a c program to implement a four function calculator : Write a C program to implement a four function calculator. The program should prompt the user for a formula.
Write end of the pipe and then executes : Child 2 redirects its input from stdin to the read end of the pipe, then it executes the "sort -r -n -k 5" command.
Calculate the average of the given numbers : Write a C++ program to read 10 integer numbers from the user and stores/puts them in an array.
Display the sum array : Write a C program that inputs 5 elements into each of 2 integer arrays. Display the sum array.

Reviews

Write a Review

 

Computer Engineering Questions & Answers

  List all police officer were assigned to either ocvw or wave

List all police officers were assigned to either the OCVW or WAVE precinct and have a status of active. List the officer ID, last name, precinct, and status.

  Prompt the user to enter a string of their choosing

Prompt the user to enter a string of their choosing. Output the string. Extend the program further by implementing the output_without.

  Write a program to recognize line patterns

Write a program to recognize line patterns in a given set of points - Applying this method for each of theN points in turn yields an efficient algorithm to the problem.

  How many customers on average are in the drive

A drive-through at a Fast Food serves 300 customers over a 10-hour day. On average, a customer spends 2 minutes waiting in line, 3 minutes placing the order.

  Factors in selecting suitable data type

Explain the factors in selecting the suitable data type for some value? Which of these is most significant?

  Write a query that will display users and their privileges

Create the following three user-defined roles that are shown in the table below and assign them the specified permissions.

  How many bits are needed for the opcode

How many bits are needed for the opcode - How many bits are left for the address part of the instruction and What is the largest unsigned binary number that can be accommodated in one word of memory?

  Write a comparative analysis of the articles in given issue

Read at least four (4) academically reviewed articles on the ethical issues that may arise in information management.

  Write a program in php and javascript

In PHP and Javascript, when the given function has verified that all of the necessary field have been filled, a cookie is added to the user's computer.

  Write a program that prints all powers of two

Write a program that prints all powers of 2 from 20 up to 220. Write a program that reads a number and prints all of its binary digits.

  Provide recommendations for securing network traffic

Explain the policy that should be used for patches and updated on both the server and the workstation OSs. Why is this an important consideration?

  Create an application role named midtermapp

Create an Application Role named MidtermApp, and give it your default password. Create the following users and groups on the local Windows Server.

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