Remove the
else
block inside the
for
loop, and add the "Not found" message inside an
if
block after the loop has completed:
for (i = 0; i < top; i++)
{
if (!strcmp(ID, info[i].ID))
{
display(i);
found = 1;
cout << "\n";
}
}
if (found == 0)
{
cout << "Not found\n";
}