University of Delaware

CISC105 - General Computer Science

Program #3

Pointers

 
 
 
Programming Assignment #3:  craps.c    
 
Create a program that simulates the game of craps.  The rules of craps are as follows:
         
         A player rolls a pair of dice.  Each of the die has six faces.
         These faces contain 1, 2, 3, 4, 5, and 6 dots.  After the dice
         have come to rest, the sum of the dots 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, 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 "point".  To win, you must continue to roll the dice
         until you "make your point".  The player loses if he rolls a 7
         before "making the point".
            
1.  You must use, at least, two other functions besides the "main()" function.  
2.  You must pass and/or return parameters between each function.      
3.  You must use random number generator functions (rand, srand) to simulate 
    the rolling of the dice.
 
Hand in a script file containing the following for grading:
    1)  a concatination (cat) of the source code
    2)  a compile (cc) of the source code
    3)  an execution (a.out) of the program
    4)  execute the program more than once