home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 May / Chip_1999-05_cd.bin / ctenari / Lukas / Unit1.~pa < prev    next >
Text File  |  1999-02-18  |  3KB  |  148 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ExtCtrls, Buttons, MmSystem;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Panel1: TPanel;
  12.     Panel2: TPanel;
  13.     Panel3: TPanel;
  14.     Panel4: TPanel;
  15.     Panel5: TPanel;
  16.     Panel6: TPanel;
  17.     Panel7: TPanel;
  18.     SpeedButton1: TSpeedButton;
  19.     SpeedButton2: TSpeedButton;
  20.     procedure Button1Click(Sender: TObject);
  21.     procedure Button2Click(Sender: TObject);
  22.     procedure SpeedButton2Click(Sender: TObject);
  23.     procedure SpeedButton1Click(Sender: TObject);
  24.   private
  25.     { Private declarations }
  26.   public
  27.   rok,a,b,c,d,e,f,m: integer;
  28.       { Public declarations }
  29.   end;
  30.  
  31. var
  32.   Form1: TForm1;
  33.  
  34. implementation
  35.  
  36. {$R *.DFM}
  37.  
  38. procedure TForm1.Button1Click(Sender: TObject);
  39. var
  40. vstup : string;
  41. begin
  42. vstup:=InputBox('Vstup roku','VypoΦtu den velikonoc','Zadej rok');
  43. rok:= Strtoint(vstup);
  44. a:= rok mod 19;
  45. b:= rok mod 4;
  46. c:= rok mod 7;
  47. d:=(19*a+24) mod 30;
  48. f:= 0;
  49. (* corection for centuries*)
  50. if rok < 2500 then f:=3;
  51. if rok < 2300 then f:=2;
  52. if rok < 2200 then f:=1;
  53. if rok < 2100 then f:=0;
  54. if rok < 1900 then f:=6;
  55. if rok < 1800 then f:=5;
  56. if rok < 1700 then f:=4;
  57. e:=(2*b+4*c+6*d +5+f) mod 7;
  58. e:=22+d+e;
  59. m:= 3;
  60. if e > 31 then
  61. begin
  62. m:=4;
  63. e:=e-31;
  64. end;
  65. if m=3 then
  66. begin
  67. Panel3.visible:=true;
  68. Panel3.Caption:=InttoStr(e-2) + '.b°ezna.' + vstup;
  69. Panel5.visible:=true;
  70. Panel5.Caption:=InttoStr(e-1) + '.b°ezna.' + vstup;
  71. Panel7.visible:=true;
  72. Panel7.Caption:=InttoStr(e) + '.b°ezna.' + vstup;
  73. end;
  74. if m=4 then
  75. begin
  76. Panel3.visible:=true;
  77. Panel3.Caption:=InttoStr(e-2) + '.dubna.' + vstup;
  78. Panel5.visible:=true;
  79. Panel5.Caption:=InttoStr(e-1) + '.dubna.' + vstup;
  80. Panel7.visible:=true;
  81. Panel7.Caption:=InttoStr(e) + '.dubna.' + vstup;
  82. end;
  83.  
  84. end;
  85.  
  86. procedure TForm1.Button2Click(Sender: TObject);
  87. begin
  88. close;
  89. end;
  90.  
  91. procedure TForm1.SpeedButton2Click(Sender: TObject);
  92. var
  93. vstup : string;
  94. begin
  95. vstup:=InputBox('Vstup roku','VypoΦtu den velikonoc','Zadej rok');
  96. rok:= Strtoint(vstup);
  97. a:= rok mod 19;
  98. b:= rok mod 4;
  99. c:= rok mod 7;
  100. d:=(19*a+24) mod 30;
  101. f:= 0;
  102. (* corection for centuries*)
  103. if rok < 2500 then f:=3;
  104. if rok < 2300 then f:=2;
  105. if rok < 2200 then f:=1;
  106. if rok < 2100 then f:=0;
  107. if rok < 1900 then f:=6;
  108. if rok < 1800 then f:=5;
  109. if rok < 1700 then f:=4;
  110. e:=(2*b+4*c+6*d +5+f) mod 7;
  111. e:=22+d+e;
  112. m:= 3;
  113. if e > 31 then
  114. begin
  115. m:=4;
  116. e:=e-31;
  117. end;
  118. if m=3 then
  119. begin
  120. Panel3.visible:=true;
  121. Panel3.Caption:=InttoStr(e-2) + '.b°ezna.' + vstup;
  122. Panel5.visible:=true;
  123. Panel5.Caption:=InttoStr(e-1) + '.b°ezna.' + vstup;
  124. Panel7.visible:=true;
  125. Panel7.Caption:=InttoStr(e) + '.b°ezna.' + vstup;
  126. SndPlaySound('joy.wav',snd_Async);
  127. end;
  128. if m=4 then
  129. begin
  130. Panel3.visible:=true;
  131. Panel3.Caption:=InttoStr(e-2) + '.dubna.' + vstup;
  132. Panel5.visible:=true;
  133. Panel5.Caption:=InttoStr(e-1) + '.dubna.' + vstup;
  134. Panel7.visible:=true;
  135. Panel7.Caption:=InttoStr(e) + '.dubna.' + vstup;
  136. SndPlaySound('joy.wav',snd_Async);
  137. end;
  138.  
  139. end;
  140.  
  141.  
  142. procedure TForm1.SpeedButton1Click(Sender: TObject);
  143. begin
  144. close;
  145. end;
  146.  
  147. end.
  148.