void seekout()
{
cout<< "Enter the employee ID you want…";
cin>> key;
int flag = 0; // set flag to off
for(int i=0; i<3; i++) // start to loop through the array
{
if (employees[i].EmpID == key) // if match is found
{
flag = 1; // turn flag on
break ; // break out of for loop
}
}
if (flag) // if flag is TRUE (1)
{
cout<< "ID has been found" << i <<".\n";
cout<<employees[i].EmpFName;
cout<<employees[i].EmpLName;
cout<<employees[i].occupation;
cout<<employees[i].salary;
}
else
{
cout<< "Sorry,ID not found."<<endl<<endl;
}
}
int main()
{
do{
cout<<"**************************************************\n";
cout<<" MENU \n";
cout<<"**************************************************\n";
cout<<"OPTIONS\n";
cout<<"1. Enter Employee Details\n";
cout<<"2. Display Database Info\n";
cout<<"3. Search for Employee\n";
cout<<"4. Sort and Display Details\n";
cout<<"5. Calculate Job Bonus\n";
cout<<"6. Exit\n";
cout<<"Choose a number";
cin>>options;
if (options == 1)
{
enterdisplay();
}
if (options == 2)
{
}
if (options == 3)
{
seekout();
}
if (options== 4)
{
organize();
}
if (options == 5)
{
bonus();
}
} while(options!=6);
return 0;
}
options is a char. You are comparing it to numbers (1,2,3. etc). You need to compare it to the ASCII characters '1', '2', '3' etc. instead. Here is a working version of main() with the calls to the rest of the program commented out: