BIO.PAS 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Uses CRT,Graph,DOS;
  2. Procedure LITTFONT;external;
  3. {$L litt.obj}
  4. Procedure SANSFONT;external;
  5. {$L sans.obj}
  6. Procedure VGADRV;external;
  7. {$L VGADRV.obj}
  8. const
  9. path = '';
  10. Size_of_Month: array [1..12] of byte =
  11. (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  12. var
  13. Gd,Gm,y1,m1,d1,num,j:Integer;
  14. y2,m2,d2,dayofweek : Word;
  15. r1,r,s :longint;
  16. f,i,e : array [1..31] of real ;
  17. {--------------------------------------}
  18. Procedure Table(j:integer);
  19. var
  20. i:byte;
  21. str1,str2,str3 : string[4];
  22. str4 :string;
  23. Begin
  24. MoveTo(10,100);
  25. SetTextStyle(SmallFont,0,0);
  26. SetColor(white);
  27. for i := 1 to j+1 do
  28. begin
  29. LineRel(0,300);
  30. str(i,str1);
  31. if i <= size_of_month[m2] then
  32. if i = d2 then
  33. begin
  34. SetColor(red);
  35. if i >= 10 then OutTextXY(GetX+5,70,str1)
  36. else OutTextXY(GetX+8,70,str1);
  37. SetColor(White);
  38. end
  39. else if i >= 10 then OutTextXY(GetX+5,70,str1)
  40. else OutTextXY(GetX+8,70,str1);
  41. MoveTo(GetX+20,100);
  42. end;
  43. Line(10,250,GetX-20,250);
  44. OutTextXY(2,245,'0');
  45. SetColor(Yellow);
  46. SetLineStyle(0,3,123);
  47. Line(65,420,95,420);
  48. SetColor(Blue);
  49. Line(270,420,300,420);
  50. SetColor(Green);
  51. Line(460,420,490,420);
  52. SetColor(White);
  53. OutTextXY(100,415,'ˆ­â¥«¥ªâ. €ªâ¨¢­');
  54. OutTextXY(305,415,'”¨§¨ç. €ªâ¨¢­');
  55. OutTextXY(495,415,'�¬®æ¨®­ «. €ªâ¨¢­');
  56. Str(d1,str1);
  57. Str(m1,str2);
  58. Str(y1,str3);
  59. str4 := concat('�¨®à¨â¬ë ­  ',str1,'/',str2,'/',str3);
  60. SetTextStyle(SansSerifFont,0,4);
  61. SetTextJustify(CenterText,CenterText);
  62. SetColor(LightBlue);
  63. OutTextXY(319,20,str4);
  64. SetTextJustify(LeftText,TopText);
  65. End;{Table}
  66. {---------------------------}
  67. Procedure Write_Bio(j:integer);
  68. var
  69. k:Integer;
  70. Begin
  71. SetColor(Blue);
  72. MoveTo(20,250-trunc(f[1]));
  73. For k := 2 to j do LineTo(GetX+20,250-trunc(f[k]));
  74. SetColor(Green);
  75. MoveTo(20,250-trunc(e[1]));
  76. For k := 2 to j do LineTo(GetX+20,250-trunc(e[k]));
  77. SetColor(Yellow);
  78. MoveTo(20,250-trunc(i[1]));
  79. For k := 2 to j do LineTo(GetX+20,250-trunc(i[k]));
  80. End;{Write_Bio}
  81. {-------------------------------}
  82. Procedure InputDates(var d1,m1,y1 : integer);
  83. var
  84. correctly: Boolean; {�ਧ­ ª ¯à ¢¨«ì­®£® ¢¢®¤ }
  85. {-------------------}
  86. Procedure InpDate(text: string; var d,m,y: integer);
  87. const
  88. YMIN = 1800; {Œ¨­¨¬ «ì­ë© ¯à ¢¨«ì­ë© £®¤}
  89. YMAX = 2000; {Œ ªá¨¬ «ì­ë© ¯à ¢¨«ì­ë© £®¤}
  90. begin {InpDate}
  91. repeat
  92. Write(text);
  93. ReadLn(d,m,y);
  94. correctly := (y >= YMIN) and (Y <= YMAX) and (m >= 1)
  95. and (m <= 12) and (d > 0);
  96. if correctly then
  97. if (m = 2) and (d = 29) and (y mod 4 = 0)
  98. then
  99. {�¨ç¥£® ­¥ ¤¥« âì: íâ® 29 ä¥¢à «ï ¢¨á®ª®á­®£® £®¤ !}
  100. else
  101. correctly := d <= Size_of_Month[m];
  102. if not correctly then
  103. WriteLn('Žè¨¡ª  ¢ ¤ â¥!')
  104. until correctly
  105. end; {InpDate}
  106. {-------------------}
  107. begin {InputDates}
  108. repeat
  109. InpDate(' ‚¢¥¤¨â¥ ¤ âã ஦¤¥­¨ï ¢ ä®à¬ â¥ „„ ŒŒ ƒƒƒƒ:',
  110. d1,m1,y1);
  111. until correctly
  112. end; {InputDates}
  113. {------------------------------}
  114. Begin
  115. ClrScr;
  116. InputDates(d1,m1,y1) ;
  117. if (RegisterBGIDriver(@VGADRV) < 1) or
  118. (RegisterBGIFont(@SANSFONT) < 1) or
  119. (RegisterBGIFont(@LITTFONT) < 1) then Halt(1);
  120. Gd := VGA;Gm:=VGAhi;
  121. InitGraph(Gd, Gm, path);
  122. if GraphResult <> grOk then
  123. Halt(1);
  124. GetDate(y2,m2,d2,dayofweek);
  125. s := trunc((22-m1)/10);
  126. r1:= trunc((y1-1899-s)*365.25) + trunc((12 * s + m1 - 14)*30.59)+29+d1;
  127. s := trunc( (22-m2)/10);
  128. r := trunc((y2-1899-s)*365.25) + trunc((12 * s + m2 - 14)*30.59)+29+d2;
  129. r := r-r1;
  130. r := r - d2;
  131. for j := 1 to size_of_month[m2] do
  132. begin
  133. f[j]:=150*sin((2*Pi*((r+j) mod 23))/23);
  134. e[j]:=150*sin((2*pi*((r+j) mod 28))/28);
  135. i[j]:=150*sin((2*pi*((r+j) mod 33))/33);
  136. End;
  137. SetLineStyle(SolidLn,1,123);
  138. SetColor(White);
  139. SetFillStyle(7,Green);
  140. Table(Size_of_month[m2]);
  141. Write_Bio(Size_of_month[m2]);
  142. Readln;
  143. CloseGraph;
  144. End.