Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
18
Добавлен:
26.05.2014
Размер:
2 Кб
Скачать
unit Unit1File;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
 with StringGrid1 do
  begin
   cells[0, 0]:='ФИО';
   cells[1, 0]:='Возраст';
   cells[2, 0]:='Рост';
   cells[3, 0]:='Цвет глаз';
   cells[4, 0]:='Цвет волос';
   cells[5, 0]:='Зарплата';
   cells[6, 0]:='Машина';
   cells[7, 0]:='Квартира'
  end
end;

procedure TForm1.Button1Click(Sender: TObject);
  type sz=record
       fio:string[15];
       vozr,rost:integer;
       cg:string[10];
       cv:string[9];
       zp:integer;
       car,kv:string[3]
      end;// sz
  var st,r:string;
     rzap:sz;
     i:integer;
      f1:TextFile;
      f2:file of sz;
begin
 AssignFile(f1,'is.txt');
 AssignFile(f2,'s1.dat');
 reset(f1);rewrite(f2);
 while not SeekEof(f1) do
   begin readln(f1,st);
    rzap.fio:=copy(st,1,15);
    r:=copy(st,16,2);rzap.vozr:=StrToInt(r);
    r:=copy(st,19,3);rzap.rost:=StrToInt(r);
    rzap.cg:=copy(st,23,10);
    rzap.cv:=copy(st,33,9);
    r:=copy(st,42,5);rzap.zp:=StrToInt(r);
    rzap.car:=copy(st,48,3);
    rzap.kv:=copy(st,52,3);
    write(f2,rzap)
   end;
    CloseFile(f1); CloseFile(f2);
    reset(f2); i:=0;
    while not eof(f2) do
     begin read(f2,rzap); i:=i+1;
       with StringGrid1 do
        begin Cells[0,i]:=rzap.fio;
              Cells[1,i]:=IntToStr(rzap.vozr);
              Cells[2,i]:=IntToStr(rzap.rost);
              Cells[3,i]:=rzap.cg;
              Cells[4,i]:=rzap.cv;
              Cells[5,i]:=IntToStr(rzap.zp);
              Cells[6,i]:=rzap.car;
              Cells[7,i]:=rzap.kv
       end
     end;
   CloseFile(f2);    
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 close
end;

end.
Соседние файлы в папке ProjFile
  • #
    26.05.2014300 б18S1.DAT
  • #
    26.05.20141 Кб18Unit1File.~dfm
  • #
    26.05.20142 Кб18Unit1File.~pas
  • #
    26.05.20147 Кб18Unit1File.dcu
  • #
    26.05.20141 Кб18Unit1File.dfm
  • #
    26.05.20142 Кб18Unit1File.pas