10.04.2010, 00:32
|
Прохожий
|
|
Регистрация: 09.04.2010
Сообщения: 9
Репутация: 10
|
|
вот так, в принципе всё должно работать, видимо ошибка в переменных...
PHP код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
f:textfile;
a: array [1..100000] of double;
d: integer;
n,i: integer;
min: double;
s: String;
begin
If OpenDialog1.Execute //открыть диалог для поиска файла
then begin
assignfile(f,'d:\text1.txt');
reset(f);
readln(f, s);
n := StrToInt(s);
readln(f, s);
min := StrToFloat(s);
a[1] := min;
for i := 2 to n
do begin
readln(f, s);
a[i] := StrToFloat(s);
if a[i] < min
then min := a[i];
end;
label1.caption:=(FloatToStr(min));
ReadLn;
Closefile(f);
end
else SHowMessage('ошбка сохранения!');
exit;
end;
end.
|