有人能告诉我为什么我的代码会抛出:
错误:无效的过程或函数引用 - Pascal
PROGRAM ITVS_19_1;
TYPE FUNC = FUNCTION(x:REAL):REAL;
VAR a, b, k1, k2:REAL;
FUNCTION f(x:REAL):REAL;
BEGIN
f:=SQR(COS(x))-2/35*COS(x)-1/35;
END;
FUNCTION g(x:REAL):REAL;
BEGIN
g:=SQR(COS(x))-2/5*COS(x)-1/25;
END;
FUNCTION PYB(f:FUNC; a, b, C:REAL):REAL;
BEGIN
WHILE ABS(F(a) - F(b)) > 0.00001 DO
BEGIN
c:=(a+b)/2;
IF (f(a)*f(c)) < 0 THEN
b:=c
ELSE
a:=c;
END;
PYB:=(a+b)/2;
END;
BEGIN
READ(a, b);
k1:=PYB(f, a, b);
k2:=PYB(f, a, b);
WRITELN('f-funksiya', k1);
WRITELN('g-funksiya', k2);
END.
答案 0 :(得分:1)
声明函数PYB
:
FUNCTION PYB(f:FUNC; a, b, C:REAL):REAL;
对此过程的调用需要三个REAL
参数,而您只传递两个:
k1:=PYB(f, a, b);