По значению s (страна) присвоить переменной st континент, на котором она находиться
Код
type
country=(...);
continent=(...);
var
s:country;
st:continent
type
country = (_england, _france, _japan, _usa, _canada, _panama);
continent = (_europe, _asia, _n_america, _s_america, _australia);
set_continent = set of continent;
const
countries: array[country] of string =
('england', 'france', 'japan', 'usa', 'canada', 'panama');
continents: array[continent] of string =
('europe', 'asia', 'north america', 'south america', 'australia');
world: array[country] of set_continent =
([_europe], [_europe], [_asia], [_n_america], [_n_america], [_n_america, _s_america]);
var
s: country;
st: continent;
T: string;
i_country: country;
i_continent: continent;
begin
write('country = '); readln(T);
for i_country := low(country) to high(country) do
if countries[i_country] = T then s := i_country;
for i_continent := low(continent) to high(continent) do
if i_continent in world[s] then writeln(continents[i_continent]);
end.
for i_country := _england to _panama do ...(это - нехорошее решение, мы привязываемся к конкретным значениям, а этого лучше не делать)
for i_country := low(country) to high(country) do ...