C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-11-2007, 02:20 PM   #1
Registered User
 
Join Date: Nov 2007
Posts: 1
Post need urgent Homework help

One of the most popular games of chance is a dice game known as “craps,” which is played in casinos and back alleys throughout the world.
The rules of the game are straightforward:

A player rolls two dice. Each die has six faces. These faces contain 1,2,3,4,5, and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2,3, or 12 on the first throw (called “craps”), the player loses (i.e., the “house” wins). If the sum is 4,5,6,8,9, or 10 on the first throw, then that sum becomes the player’s “points.” To win, you must continue rolling the dice until you “make your points.” The player loses by rolling a 7 before making the points.

Make a program to simulate the game of craps for 100 times and print number of the wins in first roll, lost in first roll, wins with points, and lost with points.
zakimasmoudi is offline   Reply With Quote
Old 11-11-2007, 02:31 PM   #2
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
So, what have you done already?
Elysia is offline   Reply With Quote
Old 11-11-2007, 03:54 PM   #3
Devil™
 
Join Date: Oct 2007
Location: IIT-Kharagpur, India
Posts: 104
if you want to generate random number for your dice throw
use the following function..
Code:
j = 1 + (int) (6.0 * (rand() / (RAND_MAX + 1.0)));
j can have values 1,2,...6 randomly whenever this line is executed.. (its not actually random but will do for you assignment)

make your own logic now
__________________
C's Motto: who cares what it means? I just compile it!!
gibsosmat is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Homework Correction !!Urgent!! andryjohn C Programming 12 07-10-2009 12:29 PM
Urgent homework help for NEWBIE Kazasan C++ Programming 12 10-11-2004 04:23 PM
Urgent - Help - Homework Question Sway2 C++ Programming 12 10-04-2002 01:35 PM
Urgent Maths Homework :( (TNT) A Brief History of Cprogramming.com 5 01-09-2002 09:01 PM
Homework kermi3 C++ Programming 15 09-26-2001 03:16 PM


All times are GMT -6. The time now is 08:48 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22