我有以下两个功能。如何更改代码以使其按字母显示?
例如,如果我定义“A”,它将只显示以 A 开头的AllRecords。
char* displayRecordContent (CountryRecordType ctryRec)
{
char * output;
output = ctryRec.Country;
return output;
}
// ====================================================================
void showAllRecords ()
{
int i=0;
char * result;
for (i=0; i<NoOfRecordsRead; i++)
{
result = displayRecordContent (globalCountryDataArray [i]);
printf ("(%d) %s\n", i, result);
}
}
输出:
(0) Andorra
(1) United Arab Emirates
(2) Afghanistan
(3) Antigua and Barbuda
(4) Anguilla
(5) Albania
(6) Armenia
(7) Netherlands Antilles
(8) Angola
(9) Antarctica