Question: Please write the problem below in C++ and also do not use bool type as a restriction to solving the program when coding it. Problem
Problem You will run a simulation to demonstrate the birthday paradox for group sizes ranging from 2 50. Requirements Name your file exam1.cpp .Place the following declaration in the global space: const int MAX_CAP 50; Use the following function prototype: double runSimulation (int size); The program takes no input from the user For each group size, run a simulation and use the results to calculate the odds of two people sharing the same birthday For example, the first group has a size of 2 Generate two random birthdays using the ordinal day of the year o o - Jan. 1 is day 1, Jan. 2 is day 2,, Feb. 1 is day 32, .Dec. 31 is day 365 See if there is a match Generate new birthdays and see if there is a match 4999 more times (for a tota of 5000 runs) Divide the total number of matches found across the 5000 runs by the number of runs; this is the probability that two people in that group will share the same birthday in a group of 2 o o o o Repeat for group size of 3, 4, 550 .Print a message to the screen showing the odds of a same birthday for each group A [truncated] sample run of your program shall look like this: For 2 people, odds of two birthdays is ~0.3%. For 3 people, odds of two birthdays is ~0.68% For 4 people, odds of two birthdays is ~1.64%. For 22 people, odds of two birthdays is ~47.98%. For 23 people, odds of two birthdays is ~51.5%. For 48 people, odds of two birthdays is ~95.82%
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
