pascal程序调用问题

来源:百度知道 编辑:UC知道 时间:2024/06/25 15:36:06
program ljlf;
var i,k:qword;
n:integer;
procedure politics;
begin
inc(i);
if i<n then history
else if i=n then begin inc(k);dec(i);end;
end;
procedure synthetical;
begin
inc(i);
if i<n then geography
else if i=n then begin inc(k);dec(i);end;
end;
procedure history;
begin
inc(i);
if i<n then begin politics;geography;end
else if i=n then begin inc(k);dec(i);end;
end;
procedure geography;
begin
inc(i);
if i<n then begin history;synthetical;end
else if i=n then begin inc(k);dec(i);end;
end;
begin
readln(n);
i:=0;
k:=0;
politics;
writeln(k mod 7654321);
end.

为什么会出现编译错误

说没有找到变量history等 我history是过程啊

你把 history 过程移动到最前。
因为 PASCAL 要先定义过程才能用,要不起码也要先声明。
"if i<n then history "用了 history 过程,但 history 在下面。所以出错。
geography 也要!