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

  Investigate what may be a perceived threat to environment

How many devices are connected to the internet - analyzing a users web access or installed applications - information security professional

  Debate the major pros and cons of implementing such a policy

Many companies, large and small, have implemented Bring Your Own Device (BYOD) policies allowing employees to use their personal smartphones and tablets.

  What is a public-key certificate

What is the difference between a private key and a secret key? What is a digital signature?

  Find approximate values for the given expected numbers

Find approximate values for these expected numbers that are as large as possible subject to the condition that it is very unlikely that a plane must be refused.

  Retailing and software

Discuss how retailing is improving the efforts along with their supply chain through the evolution of software, involving the software integration that supports these supply chain activities.

  Discuss security problems associated with the web

Evaluate the most significant security problems associated with the web

  Display the total of the grades and the classaverage

Create anapp that enables the user to select a file in which to store grades.The app should allow the user to write any number of grades intothat file.

  Make a phonebook application using c++

make a Phonebook application using C++ STL (standard template library). Use the telephone number as the key and the name as the value.

  Create a new software testing plan

The Director of Software Engineering would like to have you create a new Software Testing Plan. Using the Software Testing Plan document provided.

  Why important to formulate your brief for data presentation

Why is it so important to formulate your brief for a data presentation? Discuss some ways you would implement to formulate an effective brief.

  Complete the specification of the elevator system

Complete the specification of the elevator system given in by describing the opening and closing of the doors.

  Design and implement two classes that define progression

A numeric progression is a sequence of numbers, where each number depends on one or more of previous numbers.

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