Вопрос по типу Int64
Добавлено: 15 дек 2006, 18:22
Почему при изменении типа integer на int64,программа все равно не может работать с большими числами?
Вот код программы.
Помогите кто знает.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a,b,r,m,n,d: (integer)int64;
begin
Randomize;
m:=strtoint(edit2.text);
d :=random(m);
n:=d;
while n<>1 do begin
a:=m;b:=n;
while b<>0 do begin
r:= a mod b;
a:=b;b:=r;
end;
if a=1 then begin edit1.text:=inttostr(n);exit; end;
n:=n-1;
end;
end;
end.
Вот код программы.
Помогите кто знает.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a,b,r,m,n,d: (integer)int64;
begin
Randomize;
m:=strtoint(edit2.text);
d :=random(m);
n:=d;
while n<>1 do begin
a:=m;b:=n;
while b<>0 do begin
r:= a mod b;
a:=b;b:=r;
end;
if a=1 then begin edit1.text:=inttostr(n);exit; end;
n:=n-1;
end;
end;
end.