Добавил:
bagiwow
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Информатика / 7-8
.PAS {***************************************************
‡ ¤ ЁҐ:
1. ‚ б«®ўҐ - зҐвлҐ ЎгЄўл - Ј« блҐ;
2. ‚ б«®ўҐ, Ј« бле ЎгЄў Ў®«миҐ, 祬 ў б«Ґ¤го饬
б«®ўҐ ў нв®© бва®ЄҐ.
***************************************************}
Uses Crt;
Const K=2; L=7; M=20; N=10;
{–ўҐв д® Ё бЁ¬ў®«®ў}
TBG=0; TC=7;
TCCondition=14;
TBGline=1; TCline=15;
{‘®Ј« блҐ}
Sogl: Set of Char = ['Ѓ','‚','ѓ','„','†','‡','Љ','‹','Њ','Ќ'
,'Џ','ђ','‘','’','”','•','–','—','','™'];
{ѓ« блҐ}
Gl: Set of Char = ['Ђ','…','€','Ћ','“','›','ќ','ћ','џ'];
Procedure PrintBegin;
Begin
TextBackground(TBG);
TextColor(TC);
ClrScr;
GotoXY(30,1); WriteLn('‹ Ў®а в®а п 7');
WriteLn;
End;
Procedure PrintEnd(s:string; t:Byte);
Begin
GotoXY(1,25);
TextBackground(TBGline);
TextColor(TCline);
ClrEol;
Write(s,' гб«®ўЁо 㤮ў«Ґвў®апҐв: ',t,' б«®ў');
End;
Var One,Two:Boolean; {‚лЇ®«Ґ®бвм 1 Ё 2 гб«®ўЁ©}
i,j,h,LW,s1,s2,t:Byte;
a:array[1..M,1..N,1..L] of Char;
Procedure ArrayBegin;
Begin
{ЋзЁбвЄ ¬ ббЁў }
For i:=1 to M Do
For j:=1 to N Do
For h:=1 to L Do
a[i,j,h]:=' ';
{‡ Ї®«ҐЁҐ ¬ ббЁў }
For i:=1 to M Do
For j:=1 to N Do
Begin
LW:= Random(L-K+1)+K;
For h:=1 to LW Do
a[i,j,h]:= Chr(Random(32)+128);
End;
End;
Procedure PrintWord(Cond:Boolean);
Begin
GotoXY((j-1)*8+1,i+2);
If Cond then
Begin
t:= t+1;
TextColor(TCCondition);
Write(a[i,j]:8);
TextColor(TC);
End Else Write(a[i,j]:8);
End;
Procedure OneCondition;
Begin
ArrayBegin;
PrintBegin;
t:=0;
For j:=1 to N Do
For i:=1 to M Do
Begin
one:=True;
For h:=1 to l Do
if h mod 2 = 0 then
if not (a[i,j,h] in Gl) then
Begin
one:=False;
Break;
End;
{‚лў®¤ нЄа }
PrintWord(One);
End;
PrintEnd('ЏҐаў®¬г',t);
if ReadKey<>#13 then Halt;
End;
Procedure TwoCondition;
Begin
ArrayBegin;
PrintBegin;
t:=0;
For j:=1 to N Do
Begin
s1:=0;
s2:=0;
For i:=1 to M Do
For h:=1 to L Do
Begin
if a[i,j,h] in Gl then s1:=s1+1;
if j<N then
if a[i,j+1,h] in Gl then s2:=s2+1;
End;
two:= s1>s2;
{‚лў®¤ нЄа }
For i:=1 to M Do
PrintWord(Two);
End;
PrintEnd('‚в®а¬г',t);
End;
Begin
Randomize;
Repeat
OneCondition;
TwoCondition;
Until ReadKey<>#13;
End.
‡ ¤ ЁҐ:
1. ‚ б«®ўҐ - зҐвлҐ ЎгЄўл - Ј« блҐ;
2. ‚ б«®ўҐ, Ј« бле ЎгЄў Ў®«миҐ, 祬 ў б«Ґ¤го饬
б«®ўҐ ў нв®© бва®ЄҐ.
***************************************************}
Uses Crt;
Const K=2; L=7; M=20; N=10;
{–ўҐв д® Ё бЁ¬ў®«®ў}
TBG=0; TC=7;
TCCondition=14;
TBGline=1; TCline=15;
{‘®Ј« блҐ}
Sogl: Set of Char = ['Ѓ','‚','ѓ','„','†','‡','Љ','‹','Њ','Ќ'
,'Џ','ђ','‘','’','”','•','–','—','','™'];
{ѓ« блҐ}
Gl: Set of Char = ['Ђ','…','€','Ћ','“','›','ќ','ћ','џ'];
Procedure PrintBegin;
Begin
TextBackground(TBG);
TextColor(TC);
ClrScr;
GotoXY(30,1); WriteLn('‹ Ў®а в®а п 7');
WriteLn;
End;
Procedure PrintEnd(s:string; t:Byte);
Begin
GotoXY(1,25);
TextBackground(TBGline);
TextColor(TCline);
ClrEol;
Write(s,' гб«®ўЁо 㤮ў«Ґвў®апҐв: ',t,' б«®ў');
End;
Var One,Two:Boolean; {‚лЇ®«Ґ®бвм 1 Ё 2 гб«®ўЁ©}
i,j,h,LW,s1,s2,t:Byte;
a:array[1..M,1..N,1..L] of Char;
Procedure ArrayBegin;
Begin
{ЋзЁбвЄ ¬ ббЁў }
For i:=1 to M Do
For j:=1 to N Do
For h:=1 to L Do
a[i,j,h]:=' ';
{‡ Ї®«ҐЁҐ ¬ ббЁў }
For i:=1 to M Do
For j:=1 to N Do
Begin
LW:= Random(L-K+1)+K;
For h:=1 to LW Do
a[i,j,h]:= Chr(Random(32)+128);
End;
End;
Procedure PrintWord(Cond:Boolean);
Begin
GotoXY((j-1)*8+1,i+2);
If Cond then
Begin
t:= t+1;
TextColor(TCCondition);
Write(a[i,j]:8);
TextColor(TC);
End Else Write(a[i,j]:8);
End;
Procedure OneCondition;
Begin
ArrayBegin;
PrintBegin;
t:=0;
For j:=1 to N Do
For i:=1 to M Do
Begin
one:=True;
For h:=1 to l Do
if h mod 2 = 0 then
if not (a[i,j,h] in Gl) then
Begin
one:=False;
Break;
End;
{‚лў®¤ нЄа }
PrintWord(One);
End;
PrintEnd('ЏҐаў®¬г',t);
if ReadKey<>#13 then Halt;
End;
Procedure TwoCondition;
Begin
ArrayBegin;
PrintBegin;
t:=0;
For j:=1 to N Do
Begin
s1:=0;
s2:=0;
For i:=1 to M Do
For h:=1 to L Do
Begin
if a[i,j,h] in Gl then s1:=s1+1;
if j<N then
if a[i,j+1,h] in Gl then s2:=s2+1;
End;
two:= s1>s2;
{‚лў®¤ нЄа }
For i:=1 to M Do
PrintWord(Two);
End;
PrintEnd('‚в®а¬г',t);
End;
Begin
Randomize;
Repeat
OneCondition;
TwoCondition;
Until ReadKey<>#13;
End.
Соседние файлы в папке Информатика