
Подскажите почему ошибка: const x=0.2; y :array[1..9]of real=(0.1,0.2,-0.3,-0.04,5,6,-7.03,8,9);
function t(u:real):real; begin t:=sin(u)+cos(u); end; function p(a,b:integer; s:array[1..9] of real):real; var i:integer; d:real; begin d:=1; for i:= a to b do d:=d*v[i]; p:=d; end; Begin cls; writeln('z(x,y)=',exp(ln(t(x))*3)/p(y,1,9)+sqr(p(y,1,9))/exp(ln(t(x))*2/3)); End.

Ответы на вопрос

Ответ:
Объяснение:
Тут смысла нет передавать массив в качестве параметра, т.к. он описан как const .
Текст будет примерно такой
const x=0.2;
y :array[1..9]of real=(0.1,0.2,-0.3,-0.04,5,6,-7.03,8,9);
function t(u:real):real;
begin
t:=sin(u)+cos(u);
end;
function p(a,b:integer):real;
var i:integer; d:real;
begin
d:=1;
for i:= a to b do
d:=d*y[i];
p:=d;
end;
Begin
cls;
writeln('z(x,y)=',exp(ln(t(x))*3)/p(1,9)+sqr(p(1,9))/exp(ln(t(x))*2/3):6:4);
readln;
End.
Если нужно массив передать в функцию, то его описывают как новый тип переменной и передают
Вот так, например:
const z=9;
type mas=array[1..z] of integer;
var
u :mas;
i:integer;
// Вывод массива на экран
// a -массив n-размер,text - что хотим написать
procedure showmas(b:mas;n:integer;text:string);
var
i:integer;
begin
writeln(text);
for i:=1 to n do
write(b[i],' ');
readln;
end;
begin
for i:=1 to 9 do
u[i]:= random(20);
showmas(u,10,'Исходный массив u');
end.



The code you provided contains a few errors that need to be addressed. I'll point out the mistakes and provide the corrected version of the code:
Issue: In the function
p(a, b: integer; s: array[1..9] of real): real;
, the variablev
is used in the loop, but it is not declared or initialized anywhere. Correction: Replacev[i]
withs[i]
.Issue: The variable
y
is declared as an array of real numbers, but in the calculation ofp(y, 1, 9)
, it is being treated as an array of integers. Correction: Change the parameter types ofp
function frominteger
toreal
fora
andb
.Issue: The
exp
andln
functions require theMath
unit to be included in the code. Correction: Adduses Math;
at the beginning of the code to include theMath
unit.
Here's the corrected version of the code:
pascaluses Math; const x = 0.2; y: array[1..9] of real = (0.1, 0.2, -0.3, -0.04, 5, 6, -7.03, 8, 9); function t(u: real): real; begin t := sin(u) + cos(u); end; function p(a, b: real; s: array[1..9] of real): real; var i: integer; d: real; begin d := 1; for i := round(a) to round(b) do d := d * s[i]; p := d; end; begin writeln('z(x,y) = ', exp(ln(t(x)) * 3) / p(1, 9, y) + sqr(p(1, 9, y)) / exp(ln(t(x)) * 2 / 3)); end.
With these corrections, the code should now work correctly and produce the desired output.


Похожие вопросы
Топ вопросов за вчера в категории Информатика







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili