你必须选择 Venues :
Venues
procedure WriteFoodMenu(Venue: Venues; MFood: MFood); begin if MFood.venue = Venue then WriteLn(mfood.foodtype, ' - ', mfood.chef, ' - ', mfood.venue); end;
只有将所需的场地传递给程序才有效。现在你可以有一个MFoods列表:
const Foods: array[0..numOfFoods - 1] of MFood = ( (FoodType: 'Spaghetti'; Chef: 'Luigi'; Venue: resteraunt), ( etc...), // etc... ( etc...) ); ... Venue := FoodType('Select a venue'); for I := Low(Foods) to High(Foods) do WriteFoodMenu(Venue, Foods[I]);
请注意,显示传递的提示是有意义的 FoodType 在您出示菜单之前。您目前根本没有使用提示。
FoodType