// Explanations in the comments
int main()
{
PersonType family[20],
newBaby("Anny Dube", 20180912, "2 Sept");
//Assume the array family has been initialised
for (int i = 0; i < 20; i++)
if (family[i].birthday == newBaby.birthday) // You need to refer to a specific element
// in the array with the number "i"
// Change: family.birthday[5] --> family[i].birthday
cout << family[i].name << " share a birthday with " // You need to access the array
// element with the number "i"
// Change: family.name[5] --> family[i].name
<< newBaby.name;
return 0;
}
Comments
Leave a comment