Uses Knihovna,Crt; (**) Procedure Ramy(Kolik,Jaky:byte); Var ii:integer; Begin For ii:=1 to Kolik do Begin If ii=Jaky Then Pismo(4) else Pismo(7); Case ii Of 1: VytvorRam(6,6,18,12,1); 2: VytvorRam(63,6,75,12,1); 3: VytvorRam(6,14,18,20,1); 4: VytvorRam(63,14,75,20,1); End; Pismo(7); End; End; (**) Procedure Vytvor(Typ,Cislo,Pocet,Krok,X,Y:byte); Var i,o,t,z:integer; Begin Case Typ Of 1: Begin o:=1; For i:=1 to Pocet Do Begin If Cislo=1 then t:=Y+i-1 else t:=Y+Pocet-i; Locate(X+1-o div 2,t,Strings(o,'*')); o:=o+Krok*2; End; End; 2: Begin o:=1; For i:=1 to Pocet Do Begin if (Cislo=1) or (Cislo=3) then t:=X else t:=X+Pocet-i*Krok; if Cislo<=2 then z:=Y+i-1 else z:=Y+Pocet-i; Locate(t,z,Strings(o,'*')); o:=o+Krok; End; End; End; End; (**) Var q,a,b:integer; R:Char; J,K:byte; Label Start,Dal; Begin a:=100;b:=30;J:=1;K:=1; Randomize; Barva(7,0);ClrScr; Locate(1,4,DejNaStred('TROJUHELNIKY')); Locate(1,7,DejNaStred('Tabelatorem vyberte trojuhelnik')); Locate(1,8,DejNaStred('s nimz chcete pracovat')); Locate(1,9,DejNaStred('a stisknete enter.')); Vytvor(1,1,5,1,11,7); Vytvor(2,1,5,1,67,7); VytvorRam(2,2,79,23,2); Ramy(2,1); Start: Repeat For q:=1 to 80 do Begin Locate(q,1,Chr(Random(a)+b)); Locate(q,24,Chr(Random(a)+b)); If q<25 then Begin Locate(1,q,Chr(Random(a)+b)); Locate(80,q,Chr(Random(a)+b)); End End; Until KeyPressed; R:=Readkey; Case Ord(R) of 9: Begin If J<=2 Then Begin If K=1 then K:=2 else K:=1; Ramy(2,K); Goto Start; End; If J=3 then Begin K:=K+1;If K=5 Then K:=1; Ramy(4,K); Goto Start; End; End; 13: Begin If J>1 then Goto Dal; If (K=1) And (J=1) Then Begin J:=2; Locate(67,7,Strings(5,' '));Locate(67,8,Strings(5,' '));Locate(67,9,Strings(5,' ')); Locate(67,10,Strings(5,' '));Locate(67,11,Strings(5,' ')); Vytvor(1,2,5,1,68,7); Ramy(2,K); Goto Start; End; If (K=2) And (J=1) Then Begin J:=3;K:=1; Locate(8,7,Strings(8,' '));Locate(8,8,Strings(8,' '));Locate(8,9,Strings(8,' ')); Locate(8,10,Strings(8,' '));Locate(8,11,Strings(9,' ')); Vytvor(2,2,5,1,10,7); Vytvor(2,4,5,1,10,15); Vytvor(2,3,5,1,67,15); Ramy(4,K); Goto Start; End; End; End; Dal: ClrScr; VytvorRam(1,1,80,24,2); Locate(3,2,'Zadejte pocet radku trojuhelnika: '); Read(a); Locate(3,3,'Zadejte velikost kroku: '); Read(b); ClrScr; VytvorRam(1,1,80,24,2); Case J Of 2: Begin Case K Of 1:Vytvor(1,1,a,b,40,(24-a) div 2); 2:Vytvor(1,2,a,b,40,(24-a) div 2); End; End; 3: Begin Case K Of 1:Vytvor(2,2,a,b,40,(27-a) div 2); 2:Vytvor(2,1,a,b,40,(27-a) div 2); 3:Vytvor(2,4,a,b,40,(27-a) div 2); 4:Vytvor(2,3,a,b,40,(27-a) div 2); End; End; End; ReadKey; End.