program osi;
uses crt;
const
GREEN = 2;
BLUE = 1;
CYAN = 3;
WHITE = 7;
MAX_X = 120;
MAX_Y = 30;
PI = 3.1415926;
MX2 = MAX_X div 2;
MY2 = MAX_Y div 2;
procedure out(x,y: integer; s:char);
begin
if (x+MX2>-1) and (x+MX2<MAX_X+1) then
if (MAX_Y-(y+MY2)>0) and (MAX_Y-(y+MY2)<MAX_Y+1) then begin
gotoxy(x+MX2, MAX_Y-(y+MY2));
write(s);
end;
{----------------------------------------------------------------}
{Основная программа}
var
i, y :integer;
textcolor(WHITE);
for var x := -MX2 to MX2 do
out(x, 0, '-');
for y := -MY2 to MY2 do
out(0, y, '!');
out(-1, 14, '/');
out(1, 14, '\');
out(60, 0, '>');
{Рисуем прямую y = x}
textcolor(GREEN);
for var x:=-MY2 to MY2 do
out(x, x, '*');
{Рисуем график y=x^2}
textcolor(BLUE);
for var x := -MY2 to MY2 do begin
y:=x*x;
out(x, y, '*');
{Рисуем график y=x*sin(30)}
textcolor(CYAN);
for var x := -MX2 to MX2 do begin
y := round(x * sin(PI / 6));
read(i);
end.
Результат:
7 1
7 2
7 3
7 4
7 5
7 6
1 7
2 7
3 7
4 7
5 7
6 7
7 7
8 7
7 8
Объяснение:
program osi;
uses crt;
const
GREEN = 2;
BLUE = 1;
CYAN = 3;
WHITE = 7;
MAX_X = 120;
MAX_Y = 30;
PI = 3.1415926;
MX2 = MAX_X div 2;
MY2 = MAX_Y div 2;
procedure out(x,y: integer; s:char);
begin
if (x+MX2>-1) and (x+MX2<MAX_X+1) then
if (MAX_Y-(y+MY2)>0) and (MAX_Y-(y+MY2)<MAX_Y+1) then begin
gotoxy(x+MX2, MAX_Y-(y+MY2));
write(s);
end;
end;
{----------------------------------------------------------------}
{Основная программа}
var
i, y :integer;
begin
textcolor(WHITE);
for var x := -MX2 to MX2 do
out(x, 0, '-');
for y := -MY2 to MY2 do
out(0, y, '!');
out(-1, 14, '/');
out(1, 14, '\');
out(60, 0, '>');
{Рисуем прямую y = x}
textcolor(GREEN);
for var x:=-MY2 to MY2 do
out(x, x, '*');
{Рисуем график y=x^2}
textcolor(BLUE);
for var x := -MY2 to MY2 do begin
y:=x*x;
out(x, y, '*');
end;
{Рисуем график y=x*sin(30)}
textcolor(CYAN);
for var x := -MX2 to MX2 do begin
y := round(x * sin(PI / 6));
out(x, y, '*');
end;
read(i);
end.
Результат:
7 1
7 2
7 3
7 4
7 5
7 6
1 7
2 7
3 7
4 7
5 7
6 7
7 7
8 7
7 8
Объяснение: