I'm having trouble with this code its part of a birthday profile for class everything else works but this date.cpp file....looked all throughout forms but can't find this particular one..Please help
#include "stdafx.h"
#include "date.h"
#include <string>
using std::string;
class TestBirthday
{
public: static void main()
{
int num;
System.out.println("Enter number of people to test");
num = Console.readInt();
Birthday2 Experiment = new Birthday2(num);
System.out.println("The number of duplicates when testing " +num+ " people is "+ Experiment.countDuplicates());
}
}
class Birthday2()
{
private
int num;
private
int[]birthday;
public
Birthday2(int number)
{
num = number;
birthday = new int[num];
}
public int countDuplicates()
{
boolean duplicate = false;
int index = 0;
int dup = 0;
int day;
while (index < num)
{
day = 1 + (int)(Math.random()*365);
{
duplicate = searchBirthdays(day,index);
if (duplicate)
dup ++;
}
birthday[index] = day;
index ++;
}
return dup;
}
private boolean searchBirthdays(int bday, int end)
{
boolean found = false;
int index = 0;
while ((index < end) && (!found))
{
if(bday == birthday[index])
found = true;
index ++;
}//end while
return found;
}
}