Dice Rolling Program help

This is a discussion on Dice Rolling Program help within the C Programming forums, part of the General Programming Boards category; I can't seem to get this program down right and it's due by midnight tonight. If anyone could help me ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    3

    Dice Rolling Program help

    I can't seem to get this program down right and it's due by midnight tonight. If anyone could help me out with this code, it would be much appreciated. Here's the assignment:

    This project is designed to give you experience working with arrays and passing arrays to functions.

    The program you write will simulate the rolling of a pair of dice for as many times as the user wishes, up to 30,000 times. You will keep track of how many times a particular value is rolled, by having an array of counters. The possible values will be 2 through 12. The value 2, aka snake eyes, can only be produced when each of the two dice have come up 1's. Likewise, the value 12, aka boxcars, can only be produced when each of the two dice have come up with the value 6.

    The other values (the values between 3 and 11) will tend to occur more often than either the snake eyes or the boxcars, because there is more than one roll possible to create those values. The 3 could be gotten by die #1 rolling a 1, and die #2 rolling a 2 OR by die #1 rolling a 2 and die #2 rolling a 1. So theoretically, it is twice as likely that a 3 will be rolled, rather than a 2 or a 12. Other values rolled will exhibit other probabilities.

    The basic project is to simply simulate the rolling of two dice and count how many times each of the possible values was rolled. The counts are to be stored in an array. After all of the rolling is complete, print out the value and the number of times it was rolled. DO NOT ATTEMPT TO STORE THE INDIVIDUAL VALUES ROLLED IN AN ARRAY. Your book can really help you out with this project, since it gives an example of a similar program. You are rolling two dice, rather than one...AND...you MUST have at least one function that takes the array as an argument. I would suggest PrintCounts as a logical choice of such a function.

    You should do most of your work in functions. I would suggest that you write a function called RollDice, which would return the result of rolling 2 dice. (The sum of two individual die rolls). You should also have a function that will print out the number of rolls that occurred for each possible value. You may have other functions if you like. Your output should be formatted so that the values and number of occurrences line up in columns as shown below.

    Thanks!

    - Courtesan

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    And in case you're too busy or something else to click a link...

    Quote Originally Posted by kermi3
    Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:
    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

    Make sure you have a look at the the posting guidelines:
    http://cboard.cprogramming.com/annou...ouncementid=51
    Following the rules will ensure you get a prompt answer to your question.

    Remember, too, that the board has a search facility, a link is at the top of your screen:
    http://cboard.cprogramming.com/search.php
    It will often get you a quicker answer to your questions than waiting for a response to one you have posted.

    It appears that you are posting a homework assignment or other project.

    Please don't ask people to do all your work for you, See the announcement on Homework at the top of all forums to see what is acceptable or PM me. Basically people are happy to help, but they're not going to do it all for you.

    Show us what you've got, show your code (using code tags), or where you're confused and someone will be happy to help you I'm sure. If it's something that you absolutely don't understand how it works, like you have no clue how qsort works, then ask a general question about the function and I'm sure someone will explain it. Though they may not give you all of the code for it, but someone will explain the concept.


    On obivous homework questions especially, I like to remind people of the board's ninth guildeline, while this board is very helpful to people, make sure you have your instructor's permission before seeking help on assignments. While people on these boards are more than happy to help, we discourage people from asking for help on graded work without the instructor's permission, and we claim no repsonsibilty for any cheating or honor violations.

    Feel free to PM me with any questions.

    Good Luck,

    Kermi3

    Read and follow the above instructions, and try your post (in the same thread) again.

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    3
    I wasn't asking for all the help, I was asking how to get the array only to come up. I can't paste my code right now because the program is on another computer that isn't accessible except at my school.

    That was all. Just can't get the array to point to the proper function to get it to show up appropriately.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 11:58 PM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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