If I have 4 person. How do I create a function that can determine the oldest person below?
Person p1("JAck","Spice","48);
Person p2("Burn","Side",53);
Person p3("Leppy","Doopy",20);
Person p4("Jimmy", "Dean", 32);

I need someone to help me explain how "for" loops work.

Your problem just similar to finding the greatest number out of 4 number for this use a variable and initialize it to ZERO and check with every number if variable is less then value then assign the value to the variable some thing like this

int data=0;
int num[4]={4,10,15,12};
for(i=0;i<4;i++)
{
if(data<num[i])
data=num[i];
}

Best Of Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.