QUESTION
HoD have to find the mobile number of the faculty. HoD have to go through the faculty list that will be arranged according to the year of entry.
ANSWER
#include<iostream>
#include<string>
using namespace std;
int main()
{
int b[20],c[20],flag=0;
string a[20];
int n;cin>>n;
for(int i=0;i<n*3;i++)
{
cin>>a[i];
//cout<<a[i]<<" ";
}
string se;
cin>>se;
//cout<<se;
for(int i=0;i<n*3;i++)
{
//cout<<i<<" ";
string s=a[i];
//cout<<s<<" ";
if(s==se)
{
//cout<<"\n"<<se;
flag=i+1;
}
}
if(flag==0)
cout<<"The Entered Name is not in the Directory";
else
{
cout<<"Name TelephoneNumber Year\n";
cout<<a[flag-1]<<" "<<a[flag]<<" "<<a[flag+1];
}
return 0;
}