вот код мой. но он криво работает. на выходе получается 61 число вместо 64.
даже при том, что я вставил очень много левых нулей
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
timems:text;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
myYear, myMonth, myDay : Word;
myDate : TDateTime;
myHour, myMin, mySec, myMilli : Word;
xm,n,j,i:integer;
m:array[1..100] of byte;
begin
// Set up the myDate variable to have a December 2000 value
myDate :=now();
// And let us see what we get
DecodeTime(myDate, myHour, myMin, mySec, myMilli);
assignfile(timems,'qwerty.txt');
rewrite(timems);
xm:=MyMilli;
n:=0; j:=0;
repeat
inc
; inc(j);
m[j]:=xm mod 2;
xm:=xm div 2;
until xm=0;
if (n<10) then for xm:=1 to (10-n) do write(timems,0);
for j:=n downto 1 do write(timems,m[j]);
for i:=2 to 4 do
begin
if (i=2) then xm:=Mysec;
if (i=3) then xm:=MYmin;
if (i=4) then xm:=MYhour;
n:=0; j:=0;
repeat
inc
; inc(j);
m[j]:=xm mod 2;
xm:=xm div 2;
until xm=0;
if (n<8) then for xm:=1 to (8-n) do write(timems,0);
for j:=n downto 1 do write(timems,m[j]);
end;
mydate:=now;
Decodedate(myDate, myYear, myMonth, myDay);
n:=0;
j:=0;
for i:= 1 to 2 do
begin
if (i=1) then xm:=myday;
if (i=2) then xm:=mymonth;
n:=0; j:=0;
repeat
inc
; inc(j);
m[j]:=0;
m[j]:=xm mod 2;
xm:=xm div 2;
until xm=0;
for xm:=1 to (8-n) do write(timems,0);
for j:=n downto 1 do write(timems,m[j]);
end;
xm:=myyear;
n:=0; j:=0;
repeat
inc
; inc(j);
m[j]:=0;
m[j]:=xm mod 2;
xm:=xm div 2;
until xm=0;
for xm:=1 to (14-n) do write(timems,0);
for j:=n downto 1 do write(timems,m[j]);
closefile(timems);
end;
end.