| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- Uses Crt;
- Var
- i,j, Top,Bottom,Left,Right : longint;
- const
- f : array [1..7] of Real =
- (130.8, 146.8, 164.8, 174.6, 196.0, 220.0, 246.9);
- {-----------------------------------------------------------}
- Function Strin (i:longint) : byte;
- Var strng : string[20];
- Begin
- str(i, strng);
- strin := Length(strng) + 1;
- End;{Strin}
- {-----------------------------------------------------------}
- Procedure Nota(a:real);
- Begin
- sound(Round(a));
- delay(2500);
- Nosound
- End; {Nota}
- {-----------------------------------------------------------}
- Procedure PlayMus;
- Begin
- nota(f[1]);
- nota(f[3]);
- nota(f[5]);
- nota(f[5]);
- nota(f[3]);
- nota(f[5]);
- nota(f[3]);
- nota(f[5]);
- nota(f[1]);
- nota(f[3]);
- nota(f[1]);
- nota(f[3]);
- nota(f[5]);
- nota(f[5]);
- nota(f[4]);
- nota(f[5]);
- nota(f[4]);
- nota(f[5]);
- nota(f[7]);
- nota(f[4]);
- nota(f[1]);
- nota(f[3]);
- nota(f[5]);
- nota(f[5]);
- nota(f[3]);
- nota(f[5]);
- nota(f[3]);
- nota(f[5]);
- nota(f[1]);
- nota(f[3]);
- nota(f[1]);
- nota(f[3]);
- nota(f[1]);
- nota(f[1]);
- nota(f[3]);
- nota(f[5]);
- nota(f[3]);
- nota(f[4]);
- nota(f[4]);
- nota(f[5]);
- nota(f[7]);
- nota(f[4]);
- nota(f[7]);
- nota(f[4]);
- nota(f[7]);
- nota(f[7]);
- nota(f[2]);
- nota(f[6]);
- nota(f[6]);
- nota(f[4]);
- nota(f[6]);
- nota(f[4]);
- nota(f[6]);
- nota(f[7]);
- nota(f[4]);
- End; {PlayMus}
- {------------------------------------------------------------------}
- Procedure DrawTable(l,r,t,b: longint);
- Var a : longint;
- Const
- lg = LightGray;
- Begin
- TextColor(cyan);
- GotoXY(32,2);
- Write('Таблица умножения ');
- TextColor(LightMagenta);
- For a := 39-((abs(l-r)+1)* round(strin(r*b)/2 )) to
- (abs(l-r) +1) * strin(r*b) + (38 - (abs(l-r) * round(strin(r*b)/2))) do
- Begin
- GotoXY(a, 14 - (abs(t-b)+1) div 2 );
- Write('═');
- GotoXY(a, (15-(abs(t-b)+1) div 2 ) + (abs(t-b)+1));
- Write('═');
- end;
- Write('╝');
- GotoXY(WhereX-1, WhereY - 1 - (abs(t-b)+1));
- Write('╗');
- TextColor(green);
- For a := l to r do
- begin
- GotoXY(37-((abs(l-r)+1)*round(strin(r*b) / 2)) + (a-l+1) * strin(r*b),
- 13 - (abs(t-b)+1) div 2);
- Write(a);
- end;
- For a := t to b do
- Begin
- GotoXY(36-(abs(l-r)+1)*round(strin(r*b)/2), (14 - (abs(t-b)+1) div 2 ) + a-t+1);
- If a < 10 then
- Begin
- TextColor(green);
- Write (a);
- TextColor(13);
- Write(' ║');
- end
- else begin
- TextColor(green);
- Write(a);
- TextColor(13);
- Write(' ║');
- end;
- GotoXY(WhereX-1, WhereY+1);
- Write('╚');
- if (strin(r*b) mod 2) = 0 then
- begin
- GotoXY((41-((abs(l-r)+1)*round(strin(r*b)/2)))+(abs(l-r)+1)*
- strin(r*b),(14 - (abs(t-b)+1) div 2) + a - t +1);
- Write('║');
- end
- else
- begin
- GotoXY((41-((abs(l-r)+1)*round(strin(r*b)/2)))+(abs(l-r)+1)*
- strin(r*b) + 1,(14 - (abs(t-b)+1) div 2) + a - t +1);
- Write('║');
- end;
- end;
- GotoXY(39-((abs(l-r)+1)*round(strin(r*b) / 2 )), 14 - (abs(t-b)+1) div 2);
- Write('╔')
- end; {DrawTable}
- {----------------------------------------------------------}
- Begin
- Clrscr;
- TextMode(CO80);
- TextColor(LightGray);
- Writeln('Введите числа до которых строить таблицу, разница между которыми ');
- Writeln('меньше 18 и произведение наибольших чисел меньше 1000 ');
- Write('в формате: левое правое верхнее нижнее (1 10 2 15): ');
- Read(Left, Right, Top , Bottom);
- While (abs(left-right) > 17) or (abs(top-bottom) > 17) or
- ((abs(left-right) * strin(right*bottom)) > 70 ) do
- begin
- Write('Попробуйте снова ');
- Read(Left, Right, Top , Bottom);
- end;
- Clrscr;
- DrawTable(Left, Right, Top , Bottom);
- TextColor(yellow);
- For i := top to bottom do
- begin
- for j := left to right do
- begin
- GotoXY((37-(abs(left-right)+1)*round(strin(right*bottom) / 2)+
- (J-left+1)*strin(right*bottom)), (14-(abs(top-bottom)+1)div 2)+
- i-top+1);
- Write(I*J);
- end;
- end;
- GotoXY(30,24);
- {PlayMus;}
- TextColor(red);
- Write('... Press any key ... ');
- TextColor(lightgray);
- ReadKey
- End.
|