It is necessary to search for data by entering the type of aircraft.
This is what I have, but the result always shows that the registration does not exist.
void Search(AEROFLOT* array)
{
char plane[20];
cout << "\nEnter type of airplane: ";
fflush(stdin);
gets(plane);
for (int i = 0; i < n; i++)
{
if (plane == array[i].plane)
{
cout << "\nDestination: " << pm[i].name << endl;
cout << "Number of airplane: " << pm[i].number << endl;
cout << "\n" << endl;
break;
}
else
{
cout << "\nThere isn't an airplane of this type.\n" << endl;
break;
}
}
}
I know that there are sequential and binary search methods, but I would like to know how I can do a single search directly, since in the program all the data are first entered, then they are sorted in ascending order according to the airplane number and by Last search is done.