中间提到的过程sw(p,n)没有定义啊。去掉此行后,程序可以运行了,貌似是一个计算机产生随机数,由用户猜数的游戏程序?只是最后一个语句应改一下: if s<>p then writeln('game over! the answer is:',p);