
Добавил:
Yanus
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы Паскаль / лабы 2 / U
.pas unit U;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel3: TPanel;
Button1: TButton;
edit3: TEdit;
procedure Button1Click(Sender: TObject);
procedure Panel3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var p,q,x{,i,j}:real; j,h,i,k,x1:integer;
x2,y:real;
a:array[-6..10] of string;
b:string;
begin
x:=strtofloat(edit3.Text);
i:=0;
repeat
y:=x mod 1000;
case y of
000:a[i]:='0';
001:a[i]:='1';
010:a[i]:='2';
011:a[i]:='3';
100:a[i]:='4';
101:a[i]:='5';
110:a[i]:='6';
111:a[i]:='7';
end;
i:=i+1;
until x1=0;
repeat
b:=b+(a[j]);
j:=j-1;
until j=k;
end;
procedure TForm1.Panel3Click(Sender: TObject);
begin
panel3.Caption:=b;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel3: TPanel;
Button1: TButton;
edit3: TEdit;
procedure Button1Click(Sender: TObject);
procedure Panel3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var p,q,x{,i,j}:real; j,h,i,k,x1:integer;
x2,y:real;
a:array[-6..10] of string;
b:string;
begin
x:=strtofloat(edit3.Text);
i:=0;
repeat
y:=x mod 1000;
case y of
000:a[i]:='0';
001:a[i]:='1';
010:a[i]:='2';
011:a[i]:='3';
100:a[i]:='4';
101:a[i]:='5';
110:a[i]:='6';
111:a[i]:='7';
end;
i:=i+1;
until x1=0;
repeat
b:=b+(a[j]);
j:=j-1;
until j=k;
end;
procedure TForm1.Panel3Click(Sender: TObject);
begin
panel3.Caption:=b;
end;
end.
Соседние файлы в папке лабы 2