
24.03.2013, 02:19
|
 |
.
|
|
Регистрация: 18.05.2011
Адрес: Омск
Сообщения: 3,970
Версия Delphi: 3,5,7,10,12,XE2
Репутация: выкл
|
|
Исправленный пример
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
f : TextFile;
Count,
Search,
I, J : Integer;
buf : array of Integer;
begin
AssignFile(f, 'input.txt');
Reset(f);
ReadLn(f, Count);
SetLength(buf, Count);
for I := 0 to Count - 1 do
Read(f, buf[i]);
ReadLn(f);
ReadLn(f, Search);
CloseFile(f);
J := 0;
for I := 0 to Count - 1 do
if buf[i] = Search then
inc(J);
AssignFile(f, 'output.txt');
Rewrite(f);
WriteLn(f, 'Совпадений найдено = ', J);
CloseFile(f);
end;
input.txt
Код:
16
25 64 78 82 62 58 25 21 22 33 23 53 22 65 26 22
22
output.txt
__________________
Je venus de nulle part
55.026263 с.ш., 73.397636 в.д.
|