| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- Uses CRT,DOS;
- Const
- s : array [1..5] of string[27] = (' �à®á⮥ ',
- ' ‚§ ¨¬® ¯à®áâë¥ ',
- ' ‘®¢¥à襮¥ ',
- ' „à㦥áâ¢¥ë¥ ',
- ' ‚ë室 ');
- text1 : array [1..5] of string[50] = (' “§ âì ¯à®á⮥ «¨ ç¨á«® ',
- ' “§ âì ¢§ ¨¬® ¯à®áâë¥ «¨ 2 ç¨á« ',
- ' “§ âì ᮢ¥à襮¥ «¨ ç¨á«® ',
- ' “§ âì ¤à㦥áâ¢¥ë¥ «¨ 2 ç¨á« ',
- ' ‚ë室 ¨§ ¯à®£à ¬¬¬ë ');
- Var
- IfExit : boolean;
- CurMenu : integer;
- {-------------------------------------------}
- Procedure SetCursorSize(size:word);
- var
- reg : registers;
- begin
- with reg do begin
- AH := $01;
- CH := hi(size);
- CL := lo(size);
- Intr($10,reg);
- end;
- end;
- {------------------------------------------}
- Function ReadVal(st:string) : longint;
- Var
- rc : real;
- code : integer;
- tm : string[35];
- ch : char;
- x,r : byte;
- Begin
- TextColor(LightGray);
- GotoXY(24,20);
- Write(' ');
- GotoXY(24,20);
- Write(st);
- SetCursorSize(12*43);
- x := 24;
- repeat
- tm := '';
- GotoXY(24,22);
- Write(' ');
- GotoXY(24,22);
- Code := 0;
- x := 24;
- r := 1;
- ch := readkey;
- if ch = #13 then code := 1;
- While ch <> #13 do begin
- if ch in [#48..#57] then
- if x < 59 then
- begin
- tm := concat(tm,ch);
- GotoXY(x,22);
- Write(ch);
- inc(x);
- inc(r)
- end;
- if ch = #8 then
- if r > 0 then
- begin
- delete(tm,length(tm),1);
- dec(x);
- dec(r);
- GotoXY(x,22);
- Write(' ');
- GotoXY(x,22);
- end;
- ch := readkey;
- end;
- if length(tm) > 10 then code := 1
- else
- begin
- Val(tm,rc,code);
- if rc <= 0 then code := 1;
- end;
- until code = 0;
- ReadVal := trunc(rc);
- SetCursorSize(16*16);
- GotoXY(23,22);
- Write(' ');
- GotoXY(23,20);
- Write(' ')
- End{ReadVal};
- {---------------------------------------}
- Procedure Simple;
- Var
- v1 : longint;
- i : integer;
- Begin
- v1 := ReadVal('‚¢¥¤¨â¥ 楫®¥ ç¨á«® ');
- i := 2;
- while (v1 mod i <> 0) and (i < v1) do inc(i);
- GotoXY(24,20);
- Write(' ');
- GotoXY(24,20);
- if i = v1 then
- begin
- TextColor(LightGray);
- WriteLn('—¨á«® ',v1,' ¯à®á⮥');
- end
- else
- begin
- TextColor(LightGray);
- WriteLn('—¨á«® ',v1,' ¨¬¥¥â ¤¥«¨â¥«ì ',i);
- end;
- ReadKey;
- GotoXY(23,20);
- Write(' ');
- End;{Simple}
- {---------------------------------}
- Procedure SimpleTwice;
- Var
- v2 : longint;
- v1 : longint;
- i : integer;
- Begin
- v1 := ReadVal('‚¢¥¤¨â¥ ¯¥à¢®¥ ç¨á«® ');
- v2 := ReadVal('‚¢¥¤¨â¥ ¢â®à®¥ ç¨á«® ');
- i := 2;
- while not ((v1 mod i = 0) and (v2 mod i = 0)) and (i <= v1) do inc(i);
- GotoXY(24,20);
- Write(' ');
- GotoXY(24,20);
- if (i = v1+1) and (v2 mod v1 <> 0) then
- begin
- TextColor(LightGray);
- WriteLn('—¨á« ¢§ ¨¬® ¯à®áâë¥');
- end
- else
- begin
- TextColor(LightGray);
- WriteLn('—¨á« ¨¬¥îâ ®¡é¨© ¤¥«¨â¥«ì ',i);
- end;
- ReadKey;
- GotoXY(23,20);
- Write(' ');
- End;{SimpleTwice}
- {-------------------------------}
- Procedure Perfect;
- Var
- v1 : longint;
- i : integer;
- summa : longint;
- Begin
- v1 := ReadVal('‚¢¥¤¨â¥ 楫®¥ ç¨á«® ');
- i := 1;
- summa := 0;
- for i := 1 to v1-1 do
- if v1 mod i = 0 then Inc(summa,i);
- GotoXY(24,20);
- Write(' ');
- GotoXY(24,20);
- if summa = v1 then
- begin
- TextColor(LightGray);
- WriteLn('—¨á«® ',v1, ' ᮢ¥à襮¥');
- end
- else
- begin
- TextColor(LightGray);
- WriteLn('—¨á«® ',v1, ' ¥ ᮢ¥à襮¥ ');
- end;
- ReadKey;
- GotoXY(23,20);
- Write(' ');
- End;{Perfect}
- {-------------------------------}
- Procedure Friend;
- Var
- v2 : longint;
- v1 : longint;
- i : integer;
- summa1,summa2 : longint;
- Begin
- v1 := ReadVal('‚¢¥¤¨â¥ ¯¥à¢®¥ ç¨á«® ');
- v2 := ReadVal('‚¢¥¤¨â¥ ¢â®à®¥ ç¨á«® ');
- i := 2;
- summa1 := 0;
- summa2 := 0;
- for i := 1 to v1-1 do
- if v1 mod i = 0 then Inc(summa1,i);
- for i := 1 to v2-1 do
- if v2 mod i = 0 then Inc(summa2,i);
- GotoXY(24,20);
- Write(' ');
- GotoXY(24,20);
- if (summa1 = v2) and (summa2 = v1) then
- begin
- TextColor(LightGray);
- WriteLn('—¨á« ¤à㦥á⢥ë¥');
- end
- else
- begin
- TextColor(LightGray);
- WriteLn('—¨á« ¥ ¤à㦥á⢥ë¥');
- end;
- ReadKey;
- GotoXY(23,20);
- Write(' ');
- End;{Friend}
- {-------------------------------}
- Procedure ChangeMenu(MoveUP : integer);
- Begin
- CurMenu := Curmenu + MoveUp;
- GotoXY(28,5+(CurMenu*2));
- TextColor(Blue);
- TextBackGround(Green);
- Write(s[CurMenu]);
- GotoXY(28,5+((CurMenu-MoveUp)*2));
- TextColor(Blue);
- TextBackGround(black);
- Write(s[CurMenu-Moveup]);
- TextColor(lightgray);
- GotoXY(23,20);
- Write(' ');
- GotoXY(23,20);
- Write(text1[curmenu]);
- End;{ChangeMenu}
- {--------------------------------}
- Procedure Init;
- Var
- i : byte;
- Begin
- ClrScr;
- IFExit := false;
- SetCursorSize(16*16);
- TextColor(Green);
- GotoXY(2,2);Write('É');GotoXY(2,24);Write('È');GotoXY(79,2);Write('»');
- GotoXY(79,24);Write('¼');GotoXY(1,1);
- for i := 3 to 78 do
- begin
- GotoXY(i,2);
- Write('Í');
- GotoXY(i,24);
- Write('Í')
- end;
- For i := 3 to 23 do
- begin
- GotoXY(2,i);
- Write('º');
- GotoXY(79,i);
- Write('º')
- end;
- TextColor(Blue);
- for i:= 1 to 5 do
- begin
- GotoXY(28,5+(i*2));
- Write(s[i]);
- end;
- CurMenu := 2;
- ChangeMenu(-1);
- TextColor(Magenta);
- For i := 23 to 59 do
- begin
- GotoXY(i,19);
- Write('Í');
- GotoXY(i,21);
- Write('Í');
- GotoXY(i,23);
- Write('Í');
- end;
- GotoXY(22,19); Write('É'); GotoXY(22,20); Write('º'); GotoXY(22,23);
- Write('È'); GotoXY(60,19); Write('»'); GotoXY(60,20); Write('º');
- GotoXY(60,22); Write('º'); GotoXY(22,22); Write('º'); GotoXY(60,23);
- Write('¼'); GotoXY(22,21); Write('Ì'); GotoXY(60,21); Write('¹');
- End;{Init}
- {--------------------------------}
- Procedure Main;
- Var
- ch : char;
- Begin
- repeat
- if KeyPressed then
- begin
- ch := readkey;
- if ch = #0 then ch := readkey;
- case ch of
- #27 : IfExit := true;
- #72 : if CurMenu <> 1 then ChangeMenu(-1);
- #80 : if CurMenu <> 5 then ChangeMenu(1);
- #13 : Case CurMenu of
- 1 :Simple;
- 2 :SimpleTwice;
- 3 :Perfect;
- 4 :Friend;
- 5 :IfExit := true;
- end;
- end;
- end;
- until IFExit;
- End;{Main}
- {--------------------------------}
- Begin
- init;
- Main;
- End.
|