Функция pos(sw,ws) возвращает индекс вхождения подстроки sw в строку ws,
Function circle_func(x: real): real;
begin
circle_func := sqrt(4 - sqr(x + 8)) - 2;
end;
function line_func(x: real): real;
begin
line_func := 0.5*x + 1;
end;
function quadratic_func(x: real): real;
begin
quadratic_func := sqr(x - 6);
end;
var
x, y: real;
begin
writeln('Введите аргумент: ');
readln(x);
if ((x >= -10) and (x < -6)) then y := circle_func(x);
if ((x >= -6) and (x < 2)) then y := line_func(x);
if ((x >= 2) and (x < 6)) then y := 0;
if ((x >= 6)) then y := quadratic_func(x);
writeln(y:5:3);
end.
Program yravnenie;
Var
a,b,c,D,x1,x2,p,q:Real;
Begin
Repeat
Write('a= ');
Readln(a);
if a=0 then writeln('Error: a=0. Enter another value');
Until a<>0;
Write('b= ');
Readln(b);
Write('c= ');
Readln(c);
p:=b/a;
q:=c/a;
D:=Sqr(p/2)-q;
If D>0 then
begin
Writeln('x1 = ',-p/2-Sqrt(D):0:5);
Writeln('x2 = ',-p/2+Sqrt(D):0:5);
end
else
If D=0 then
Writeln('x1 = x2 = ',-p/2:0:5)
else
begin
Writeln('x1 = ',-p/2:0:5,'-i*',Sqrt(-D):0:5);
Writeln('x2 = ',-p/2:0:5,'+i*',Sqrt(-D):0:5);
end;
Readln;
End.