var cp:integer;
label 1,2,3,4;
begin sp:=0;num:=n;
x:=a;y:=b;z:=c;
cp:=1;
repeat
case cp of
1:if num>0 then
begin push(2);
num:=num-1;
swap(y,z);
cp:=1
end
else cp:=4;
2:begin print(num,x,z);
push(3);
num:=num-1;
swap(x,y);
cp:=1
end;
3:cp:=4;
4:pop();
end
until sp=0;以上是我的一段程序,但是编译出现警告:
Warning: Label not defined "1"
Warning: Label not defined "2"
Warning: Label not defined "3"
Warning: Label not defined "4"请问在Pascal里面如何使用整数标号呢?
label 1,2,3,4;
begin sp:=0;num:=n;
x:=a;y:=b;z:=c;
cp:=1;
repeat
case cp of
1:if num>0 then
begin push(2);
num:=num-1;
swap(y,z);
cp:=1
end
else cp:=4;
2:begin print(num,x,z);
push(3);
num:=num-1;
swap(x,y);
cp:=1
end;
3:cp:=4;
4:pop();
end
until sp=0;以上是我的一段程序,但是编译出现警告:
Warning: Label not defined "1"
Warning: Label not defined "2"
Warning: Label not defined "3"
Warning: Label not defined "4"请问在Pascal里面如何使用整数标号呢?
/////////////////
是不是应该1,2,3,4:label;
begin
1:
showmessage('1');
2:
showmessage('2');
3:
showmessage('3');
4:
showmessage('4');
end;定义后要应用现在的程序应该不用GOTO
就出现了上面的警告,但是是可以正常运行的。之后我改用turbo pascal之后
警告就没有了,也可以正常运行。
有道理