plz cheak this
if you dont know? >>>>>surf birthday paradox
#include <iostream>
using namespace std;
#include <stdlib.h>
#include <time.h>
const int SAMPLE_SIZE = 24;
const int NUMBER_OF_SETS = 1000;
int Menu(int);
void ExplainBirthdayParadox();
void VerifyBirthdayParadox(int Birthday[]);
void SortBirthdaySet(int List[], int Last);
inline void Swap(int &A, int &B);
void LookForMatch(int Birthday[]);
void GenerateBirthdaySet(int Birthday[]);
void DisplayBirthdayParadox();
void DisplayVerification(int);
int main()
{
int Birthday[SAMPLE_SIZE + 1];
int MenuChoice = 0;
srand(time_t(NULL));
do
{
MenuChoice = Menu(MenuChoice);
switch (MenuChoice)
{
case 0:
break;
case 1:
ExplainBirthdayParadox();
break;
case 2:
VerifyBirthdayParadox(Birthday);
break;
case 3:
GenerateBirthdaySet(Birthday);
}
} while (MenuChoice != 0);
}
int Menu(int MenuChoice)
{
cout << "1) Explain birthday paradox\n";
cout << "2) Check Birthday paradox by generating 1000 sets of birthdays\n";
cout << "3) Display one set of 23 birthdays\n";
cout << "E) Exit (enter 0 to exit)\n";
cout << "What would you like to do? Please choose between 1-3 or E(0) to exit : \n";
cin >> MenuChoice;
return MenuChoice;
}
void ExplainBirthdayParadox()
{
cout << "If 23 persons are chosen at random, then the chances are more ";
cout << "than 50% that at least two will have the same birthday!\n\n";
}
void VerifyBirthdayParadox(int Birthday[])
{
int k, NumberOfMatches = 0;
//for (k = 1; k < NUMBER_OF_SETS; k++)
//{
GenerateBirthdaySet(Birthday);
//SortBirthdaySet(Birthday, SAMPLE_SIZE+1);
//LookForMatch(Birthday);
//NumberOfMatches++;
//}
cout << Birthday << "\n";
//DisplayVerification(NumberOfMatches);
}
void GenerateBirthdaySet(int Birthday[])
{
int i;
for (i = 1; i < SAMPLE_SIZE; ++i) {
Birthday[i] = ((rand() % 365) + 1);
printf("%i\n", Birthday[i]);
}
}