Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 PLEASE HELP ME RIGHT AWAY! a small but important question
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
scottyrush13




PostPosted: 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!
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Thu Nov 04, 2004 4:45 pm   Post subject: (No 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:

  • How to use randint to get a random number in a certain range (1-6 in this case)?
  • What an array is?
  • How to create a one-dimensional array?
  • How to put values into an array?
  • How to get values out of an array?


I invite you to look at the Turing Tutorials forum for answers to these questions.

Random Numbers
Arrays
Dan




PostPosted: Thu Nov 04, 2004 4:48 pm   Post subject: (No 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
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Cervantes




PostPosted: Thu Nov 04, 2004 4:49 pm   Post subject: (No subject)

read me
to add to wtd's list, you'll need to know how to use a for loop as well.
scottyrush13




PostPosted: Thu Nov 04, 2004 4:49 pm   Post subject: (No 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
Dan




PostPosted: Thu Nov 04, 2004 4:52 pm   Post subject: (No subject)

code:

for i: 1..10
put myArray(i), " "
end for


that whould print the array, the addtion to it whould work much the same way....[/code]
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
scottyrush13




PostPosted: Thu Nov 04, 2004 4:53 pm   Post subject: (No subject)

thanks for the help im starting to understand this more...sorry for not following the etiquette of the forum Embarassed
wtd




PostPosted: Thu Nov 04, 2004 4:56 pm   Post subject: (No subject)

scottyrush13 wrote:
thanks for the help im starting to understand this more...sorry for not following the etiquette of the forum Embarassed


You get one pass. Just, now that you know, follow the rules. Smile
Sponsor
Sponsor
Sponsor
sponsor
scottyrush13




PostPosted: Thu Nov 04, 2004 5:03 pm   Post subject: (No 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
wtd




PostPosted: Thu Nov 04, 2004 5:11 pm   Post subject: (No subject)

Well, some of us have way too much free time.
Dan




PostPosted: Thu Nov 04, 2004 6:00 pm   Post subject: (No 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 Razz.

It was 24 vs 1 at one point yet i still won Wink can not beat my mad deleteing and baning skillz. Also help that the bell rang and they all whent home to there paerents Razz
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Andy




PostPosted: Thu Nov 04, 2004 6:07 pm   Post subject: (No subject)

wait where was this lol
eNc




PostPosted: Thu Nov 04, 2004 6:07 pm   Post subject: (No subject)

omg wtd ure my hero
wtd




PostPosted: Thu Nov 04, 2004 6:44 pm   Post subject: (No subject)

eNc wrote:
omg wtd ure my hero


Wow. Thanks. Not that my ego needed it, but thanks. Smile
Dan




PostPosted: Thu Nov 04, 2004 8:46 pm   Post subject: (No 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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: