#include<iostream>
using namespace std;
#include<string.h>
#include<conio.h>
struct info
{
int yob;
char nam[10],ntn[10];
};
void main()
{
info ob[3];
int age[3],i,yr;
cout<<"enter current year"<<endl;
cin>>yr;
for(i=0;i<3;i++)
{
cout<<"enter year of birth"<<endl;
cin>>ob[i].yob;
cout<<"enter name"<<endl;
cin>>ob[i].nam;
cout<<"enter nationality"<<endl;
cin>>ob[i].ntn;
}
for( i=0;i<3;i++)
{
age[i]=yr-ob[i].yob;
}
for( i=0;i<3;i++)
{
if(age[i]<=30)
cout<<"name"<<ob[i].nam<<endl;//if age is less than or equal to 30 this will show name
}
for( i=0;i<3;i++)
{
if(age[i]>40)
cout<<"nationality"<<ob[i].nam<<endl;//it will show nationality if age is greater than 40
}
_getch();
}