Дан список друзей: фамилии, имена, адреса (город, улица, дом, квартира). Требуется:
а) найти фамилию человека по заданному адресу;
б) найти адрес по введенной фамилии;
в) найти фамилии тех, кто живет в разных городах, но имеет одинаковый адрес.
type
friend = record
name, surname: string[64];
adress: record
city, street: string[64];
home, flat: integer;
end;
end;
var friends: array[1..64] of friend; surname, city, street, n, i, home, flat: integer;
begin
readln;
for i := 1 to n do begin
with friends do begin
readln(name);
readln(surname);
with adress do begin
readln(city);
readln(street);
readln(home);
readln(flat);
end;
end;
end;
readln(city);
readln(street);
readln(home);
readln(flat);
for i := 1 to n do begin
with friends do
if ((adress.city = city) and (adress.street = street) and (adress.home = home) and (adress.flat = flat)) then writeln(friends.surname);
end;
readln(surname);
for i := 1 to n do begin
if (friends.surname = surname) then writeln(friends.adress.city);
end;
readln(street);
readln(home);
readln(flat);
for i := 1 to n do begin
with friends do
if (adress.city <> city and adress.street = street and adress.home = home and adress.flat = flat) then writeln(friends.surname);
end;
end.
а) найти фамилию человека по заданному адресу;
б) найти адрес по введенной фамилии;
в) найти фамилии тех, кто живет в разных городах, но имеет одинаковый адрес.
type
friend = record
name, surname: string[64];
adress: record
city, street: string[64];
home, flat: integer;
end;
end;
var friends: array[1..64] of friend; surname, city, street, n, i, home, flat: integer;
begin
readln;
for i := 1 to n do begin
with friends do begin
readln(name);
readln(surname);
with adress do begin
readln(city);
readln(street);
readln(home);
readln(flat);
end;
end;
end;
readln(city);
readln(street);
readln(home);
readln(flat);
for i := 1 to n do begin
with friends do
if ((adress.city = city) and (adress.street = street) and (adress.home = home) and (adress.flat = flat)) then writeln(friends.surname);
end;
readln(surname);
for i := 1 to n do begin
if (friends.surname = surname) then writeln(friends.adress.city);
end;
readln(street);
readln(home);
readln(flat);
for i := 1 to n do begin
with friends do
if (adress.city <> city and adress.street = street and adress.home = home and adress.flat = flat) then writeln(friends.surname);
end;
end.