Question: Using c++ and could I get comments so I know how the code works. Thank you very much! In a football or soccer game, you
Using c++ and could I get comments so I know how the code works. Thank you very much!
In a football or soccer game, you have 22 players, from both teams, in the field. What is the probability of having at least any two players with the same birthdays? (just assume 365 days a year and dont have to do the exact calendar month and day, use the day number from 1 to 365)
Please use two approaches to solve the problem.
One, find the closed form mathematical solution by probability theory. Show your derivation/proof. This require some research of your own.
Two, write a program to, first, simulate the birthdays for each of the players per iteration for a specified number of iterations. For each iteration, look for and record the occurrence of same birthdays. Finally, after all the iterations are completed, produce the results as a ratio of occurrence of same birthdays(from at least two players) over the number of iterations.
Run your program for cases of 10, 50, 100, 500 and 5000 iterations, or more. The larger the number of iterations (samples), the closer the result is to the theoretical probability. What do you call this theory, or law? ( Ive already given two-third of the name in the last sentence and question)
Pointers:
For approach #1, you are free to do your research and study from any source, but do your own work. Please submit a .docx or .txt file with your derivation and discussion.
For approach #2, the problem statement implies you need to do a match-search after generating the birthdays; and then do the booking keeping of the results for all iterations. Good opportunity to apply "arrays"'.
Before using srand() and rand() to generate the birthdays, just typing in a set of fixed data into the birthday array to verify your algorithms for the search, book keeping and data output first.
All prior documentation and code structure requirements also apply to this project.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
