You are on page 1of 2

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
Buttons, StdCtrls;

type

{ TForm1 }

TForm1 = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Button1: TButton;
Edit1: TEdit;
OpenDialog1: TOpenDialog;
StringGrid1: TStringGrid;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private

public

end;

var
Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);


begin
Close;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);


begin
if OpenDialog1.Execute then
begin
Edit1.Text:= OpenDialog1.FileName;
end;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);


var
ArqImp : TextFile;
i, N : integer;
N1, Linha: String;
XCoord : Array of real;
M : double;

begin
AssignFile(ArqImp, Edit1.Text);
Reset(ArqImp);
Readln(ArqImp, N1);

// M := strtofloaT(N1);
N:=10;
setlength(XCoord, N);
Stringgrid1.ColCount:= 1;
Stringgrid1.rowCount:= n+1;

i := 0;
While not eof(ArqImp) do
begin
ReadLn(ArqImp, Linha);
XCoord[i] := strtofloat(Linha);
i := i+1;
end;
CloseFile(ArqImp);

For i := 0 to n-1 do StringGrid1.Cells[0,i]:=FloatToStr(Xcoord[i]);

end;

end.

You might also like