Computer Science Canada PLEASE HELP ME RIGHT AWAY! a small but important question |
Author: | scottyrush13 [ Thu Nov 04, 2004 4:31 pm ] |
Post subject: | PLEASE HELP ME RIGHT AWAY! a small but important question |
im new to turing and just taking a turing course in my highschool and i got a question that im not sure how to do, i have it done up to a point and i dont even know if thats right...heres the question: "Write a program that simulates the rolling of two dice. The program should use randint to roll the first die, and should use randint again to roll the second die. The sum of the two values should then be calculated. Note: Since each die can show an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12 with 7 being the most frequent sum and 2 and 12 being the least frequent sums. Your program should roll the two die 36, 000 times. Use a one dimensional array to tally the numbers of times each possible sum appears. Print the results in a tabular format on the screen." if anyone can help me by telling me a)what to do, or b)write the program and then copy and paste it, i would really appreciate it thanks to whomever might reply! |
Author: | wtd [ Thu Nov 04, 2004 4:45 pm ] |
Post subject: | |
It's against unofficial policy for those who frequent these boards to simply provide answers. This is cheating. Already there have been significant complaints about this levied against this site. We don't want instructors banning students from visiting, because this site can be a tremendous help for those open to learning. With that out of the way, do you understand:
I invite you to look at the Turing Tutorials forum for answers to these questions. Random Numbers Arrays |
Author: | Dan [ Thu Nov 04, 2004 4:48 pm ] |
Post subject: | |
Since this is your 1st post i will be nice. on this site there are some rules and guid lines about making posts and sicslky post in this section. To start with the subject of your post should not be "i need help" or "i have a question" we know this other wise u whould not be posting in truing help:p it also makes it harder for poleop trying to find awsers when the subjects are like this. in addtion using all caps is a bad idea online at any time. Now on the content of your post......ushely u will get 100 times more help and 100 times less flaming if u post some code in witch u tryed to slove the pobrlem. This makes it so a) we know u are not just trying to get us to do your home work and b) it makes it easyer to help b/c it shows what level u are at and gives us somting to wrok with. Now for the question: what you are going to need to do is make an array that is the size of all posable sums, then u make a for loop and in it u first add together two ranint comands that will return a number from 1 to 6 each. next u add one to that index of the array (so if the sum was 5, then the idex to add 1 to whould be 5). Affter that u will have an array that has the values of the sums that u just need to print out using a for loop. P.S. make shure to set all the elements of the array to 0 1st. EDIT: dang fast posting wtd :p |
Author: | Cervantes [ Thu Nov 04, 2004 4:49 pm ] |
Post subject: | |
read me to add to wtd's list, you'll need to know how to use a for loop as well. |
Author: | scottyrush13 [ Thu Nov 04, 2004 4:49 pm ] |
Post subject: | |
i understand how to use randint and that stuff and i know what an array is but i dont know how to add or get values from the array...but i will read the link you provided, and i never meant to take someones answer and use it directly, i wanted to look at HOW they added values to an array and how they outputted the values |
Author: | Dan [ Thu Nov 04, 2004 4:52 pm ] | ||
Post subject: | |||
that whould print the array, the addtion to it whould work much the same way....[/code] |
Author: | scottyrush13 [ Thu Nov 04, 2004 4:53 pm ] |
Post subject: | |
thanks for the help im starting to understand this more...sorry for not following the etiquette of the forum |
Author: | wtd [ Thu Nov 04, 2004 4:56 pm ] |
Post subject: | |
scottyrush13 wrote: thanks for the help im starting to understand this more...sorry for not following the etiquette of the forum
You get one pass. Just, now that you know, follow the rules. |
Author: | scottyrush13 [ Thu Nov 04, 2004 5:03 pm ] |
Post subject: | |
another thing, i want to compliment everyone on the speed of replying...i thought i'd have to wait a few hours before anyone replied... im impressed |
Author: | wtd [ Thu Nov 04, 2004 5:11 pm ] |
Post subject: | |
Well, some of us have way too much free time. |
Author: | Dan [ Thu Nov 04, 2004 6:00 pm ] |
Post subject: | |
I was just fighting off a school of mass flaming spamers who desied that insted of doing work in compsci class they whould mess up the site so i was all ready on for a bit . It was 24 vs 1 at one point yet i still won can not beat my mad deleteing and baning skillz. Also help that the bell rang and they all whent home to there paerents |
Author: | Andy [ Thu Nov 04, 2004 6:07 pm ] |
Post subject: | |
wait where was this lol |
Author: | eNc [ Thu Nov 04, 2004 6:07 pm ] |
Post subject: | |
omg wtd ure my hero |
Author: | wtd [ Thu Nov 04, 2004 6:44 pm ] |
Post subject: | |
eNc wrote: omg wtd ure my hero
Wow. Thanks. Not that my ego needed it, but thanks. |
Author: | Dan [ Thu Nov 04, 2004 8:46 pm ] |
Post subject: | |
dodge_tomahawk wrote: wait where was this lol
It was on the forum today, i deleted almost all of it. There is still the one where i yelled at one of them and baned them good. |