Computer Science Canada Help me with this problem plz... |
Author: | KillCloud [ Sat May 27, 2006 12:22 pm ] |
Post subject: | Help me with this problem plz... |
Please help me to write a program that does the following: Suppose that people enter an empty room until a pair of people share a birthday. Write a program to find out how many people will have to enter before there is a match. Assume birthdays are uniform random integers between 0 and 364. thanks |
Author: | jamonathin [ Sat May 27, 2006 1:04 pm ] |
Post subject: | |
Well, it's obvious what time of the year it is - [FP] Time. The members of CompSci.ca do not do homework assignments for other people, and it's obvious that it's for school. Now hopefully for your sake you have been paying attention in class and you can attempt a program of your own. Once you manage to accomplish that, then we can assist you in your program. Untill then try something of your own and refer to the Turing Walkthrough for explanations on commands. |
Author: | upthescale [ Sat May 27, 2006 2:39 pm ] | ||
Post subject: | |||
Ok, terrible coding, but it still does the job...the delay is at the bottom set to '30' so the years and births will go fast, but it will take shorter time to find a match! play with the delay to apeed it or slow it doen
|
Author: | KillCloud [ Sat May 27, 2006 3:11 pm ] | ||
Post subject: | |||
thx for your reply however, im thinking of a easier way, where the numbers from 0 to 364 can represent the specific dates (doesnt matter which year they were born in) and i have problems with the counting part, where i have to output the number of people who had already entered the room when there is a match of the same birthday here is what i have so far. it's messed up all right
|
Author: | Clayton [ Sat May 27, 2006 7:04 pm ] | ||
Post subject: | |||
your program should look something like that you mostly have it |
Author: | MysticVegeta [ Sat May 27, 2006 8:00 pm ] | ||
Post subject: | |||
I dont understand why you have the if structure and the for loop to output brithday, also you need 1 extra line before the end loop, "exit when flag"..
|
Author: | KillCloud [ Sat May 27, 2006 8:20 pm ] |
Post subject: | |
thanks a lot that really helps, i really appreciate that ![]() |