pascalabcnet/_Presentations/2015 New Features/Programs/15_Dict.pas

14 lines
371 B
ObjectPascal
Raw Permalink Normal View History

2015-05-14 22:35:07 +03:00
begin
var dct := Dict(KV('цвет','color'));
2015-05-14 22:35:07 +03:00
foreach var s in ReadLines('translations.txt') do
begin
var ss := s.ToWords;
dct.Add(ss[0],ss[1]);
end;
writeln(dct);
var word := ReadString('Введите слово:');
2015-05-14 22:35:07 +03:00
if dct.ContainsKey(word) then
Println('Перевод:',dct[word])
else Println('Нет такого слова!')
2015-05-14 22:35:07 +03:00
end.