x := 0; repeat x := x + 0.03; y := f(x); SetPixel(round(300 + 10 * x), round(240 - 10 * f(x)), clGreen); until 300 + 10 * x > 620 end.
с апгрейдом
uses graphabc; const scale = 20;
var i: integer; x, y: real;
function f(x: real): real; begin if x < 0 then f := 0 else f := sqrt(3 * x); end;
begin Window.Init(0, 0, 1000, 1000, clMoneyGreen); Window.CenterOnScreen;
Line(0, Window.Height div 2, Window.Width, Window.Height div 2); Line(Window.Width div 2, 0, Window.Width div 2, Window.Height); TextOut(Window.Width div 2 + 5, 10, 'y=sqrt(3x)');
x := -1; repeat SetPixel(round(Window.Width div 2 + scale * x), round(Window.Height div 2 - scale * f(x)), clRed); x := x + 0.03; until scale * x > Window.Width div 2 end.
Const N = 33; Var A:array[1..N] of integer; i:integer; Begin Randomize; Write('Исходный массив:'); For i:= 1 to N do Begin A[i]:=random(100000)-50000; Write(' ',A[i]); End; WriteLn; WriteLn; Write('Трёхзначные числа:'); For i:= 1 to N do if (99<Abs(A[i]))and(Abs(A[i])<1000) then Write(' ',A[i]); WriteLn; Write('Номера четырёхзначных чисел:'); For i:= 1 to N do if (999<Abs(A[i]))and(Abs(A[i])<10000) then Write(' ',i) End.
var
i: integer;
x, y: real;
function f(x: real): real;
begin
f := sqrt(3 * x);
end;
begin
Line(0, 240, 620, 240);
Line(300, 0, 300, 900);
TextOut(310, 10, 'y=sqrt(3x)');
x := 0;
repeat
x := x + 0.03;
y := f(x);
SetPixel(round(300 + 10 * x), round(240 - 10 * f(x)), clGreen);
until 300 + 10 * x > 620
end.
с апгрейдом
uses graphabc;
const
scale = 20;
var
i: integer;
x, y: real;
function f(x: real): real;
begin
if x < 0 then
f := 0
else
f := sqrt(3 * x);
end;
begin
Window.Init(0, 0, 1000, 1000, clMoneyGreen);
Window.CenterOnScreen;
Line(0, Window.Height div 2, Window.Width, Window.Height div 2);
Line(Window.Width div 2, 0, Window.Width div 2, Window.Height);
TextOut(Window.Width div 2 + 5, 10, 'y=sqrt(3x)');
x := -1;
repeat
SetPixel(round(Window.Width div 2 + scale * x), round(Window.Height div 2 - scale * f(x)), clRed);
x := x + 0.03;
until scale * x > Window.Width div 2
end.
N = 33;
Var
A:array[1..N] of integer;
i:integer;
Begin
Randomize;
Write('Исходный массив:');
For i:= 1 to N do
Begin
A[i]:=random(100000)-50000;
Write(' ',A[i]);
End;
WriteLn;
WriteLn;
Write('Трёхзначные числа:');
For i:= 1 to N do
if (99<Abs(A[i]))and(Abs(A[i])<1000) then Write(' ',A[i]);
WriteLn;
Write('Номера четырёхзначных чисел:');
For i:= 1 to N do
if (999<Abs(A[i]))and(Abs(A[i])<10000) then Write(' ',i)
End.
Пример:
Исходный массив: 12916 46699 20251 -36637 -14335 -33817 -25279 -5819 -6258 23375 15258 1264 10987 42877 9875 3515 -22647 -791 47876 -319 -23437 -43546 -46174 -29378 -17999 -37325 -10130 -38120 -40079 -12188 -34612 -17302 28074
Трёхзначные числа: -791 -319
Номера четырёхзначных чисел: 8 9 12 15 16