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);
Answers & Comments
Verified answer
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.