
Добавил:
bagiwow
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
{***************************************************
‡ ¤ ЁҐ:
1. „«Ё б«®ў ҐзҐв Ё б।пп ЎгЄў - Ј« б п;
2. ‚ бв®«ЎжҐ - ¬ ЄбЁ¬ «м®Ґ зЁб«® 3-е ЎгЄўҐле б«®ў.
***************************************************}
Uses Crt;
Const K=2; L=7; M=20; N=10;
{–ўҐв д® Ё бЁ¬ў®«®ў}
TBG=0; TC=7;
TCCondition=14;
TBGline=1; TCline=15;
{ѓ« блҐ}
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,s,max,t:Byte;
a:array[1..M,1..N,1..L] of Char;
b:array[1..M,1..N] of Byte;
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
b[i,j]:= Random(L-K+1)+K;
For h:=1 to b[i,j] 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]);
TextColor(TC);
End Else Write(a[i,j]);
End;
Begin
Randomize;
{‡ жЁЄ«Ёў ЁҐ Ї® ¦ вЁо Enter}
Repeat
{Џа®ўҐаЄ гб«®ўЁ© Ё Ї®¤бзҐв б«®ў}
{1 “б«®ўЁҐ}
ArrayBegin;
PrintBegin;
t:=0;
For j:=1 to N Do
For i:=1 to M Do
Begin
One:= (b[i,j] mod 2 = 1) and
(a[i,j,(b[i,j] div 2 + 1)] in Gl);
{‚лў®¤ нЄа }
PrintWord(One);
End;
PrintEnd('ЏҐаў®¬г',t);
if ReadKey<>#13 then Break;
{2 “б«®ўЁҐ}
ArrayBegin;
PrintBegin;
t:=0;
{ЋЇаҐ¤Ґ«ҐЁҐ бв®«Ўж б ¬ ЄбЁ¬ «мл¬ зЁб«®¬ 3-е ЎгЄўҐле б«®ў}
max:=0;
For j:=1 to N Do
Begin
s:=0;
For i:=1 to M Do
if b[i,j] = 3 then s:= s+1;
if s>max then max:=s;
End;
{‘®Ўб⢥® Їа®ўҐаЄ гб«®ўЁп}
For j:=1 to N Do
Begin
s:=0;
For i:=1 to M Do
if b[i,j] = 3 then s:= s+1;
{‚лў®¤ нЄа }
Two:= s=max;
For i:=1 to M Do
PrintWord(Two);
End;
PrintEnd('‚в®а¬г',t);
Until ReadKey<>#13;
End.
‡ ¤ ЁҐ:
1. „«Ё б«®ў ҐзҐв Ё б।пп ЎгЄў - Ј« б п;
2. ‚ бв®«ЎжҐ - ¬ ЄбЁ¬ «м®Ґ зЁб«® 3-е ЎгЄўҐле б«®ў.
***************************************************}
Uses Crt;
Const K=2; L=7; M=20; N=10;
{–ўҐв д® Ё бЁ¬ў®«®ў}
TBG=0; TC=7;
TCCondition=14;
TBGline=1; TCline=15;
{ѓ« блҐ}
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,s,max,t:Byte;
a:array[1..M,1..N,1..L] of Char;
b:array[1..M,1..N] of Byte;
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
b[i,j]:= Random(L-K+1)+K;
For h:=1 to b[i,j] 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]);
TextColor(TC);
End Else Write(a[i,j]);
End;
Begin
Randomize;
{‡ жЁЄ«Ёў ЁҐ Ї® ¦ вЁо Enter}
Repeat
{Џа®ўҐаЄ гб«®ўЁ© Ё Ї®¤бзҐв б«®ў}
{1 “б«®ўЁҐ}
ArrayBegin;
PrintBegin;
t:=0;
For j:=1 to N Do
For i:=1 to M Do
Begin
One:= (b[i,j] mod 2 = 1) and
(a[i,j,(b[i,j] div 2 + 1)] in Gl);
{‚лў®¤ нЄа }
PrintWord(One);
End;
PrintEnd('ЏҐаў®¬г',t);
if ReadKey<>#13 then Break;
{2 “б«®ўЁҐ}
ArrayBegin;
PrintBegin;
t:=0;
{ЋЇаҐ¤Ґ«ҐЁҐ бв®«Ўж б ¬ ЄбЁ¬ «мл¬ зЁб«®¬ 3-е ЎгЄўҐле б«®ў}
max:=0;
For j:=1 to N Do
Begin
s:=0;
For i:=1 to M Do
if b[i,j] = 3 then s:= s+1;
if s>max then max:=s;
End;
{‘®Ўб⢥® Їа®ўҐаЄ гб«®ўЁп}
For j:=1 to N Do
Begin
s:=0;
For i:=1 to M Do
if b[i,j] = 3 then s:= s+1;
{‚лў®¤ нЄа }
Two:= s=max;
For i:=1 to M Do
PrintWord(Two);
End;
PrintEnd('‚в®а¬г',t);
Until ReadKey<>#13;
End.