猜数字的pascal 哪里错了啊?

2025-06-29 08:16:46
推荐回答(4个)
回答1:

既然答对了当然自动关闭!
而且你的程序限制了必须要在10次之内猜到,超过了10次当然就关闭了!
另外,你的程序并没有错,只是有一点小问题
if(j=10)and(h <> z)then;
writeln('you are fail, the number is',z);
end.
你不是判断完之后加了分号,就是说你的判断根本没用!
应该是:
if(j=10)and(h <> z)then
writeln('you are fail, the number is',z);
end.

我不知道你的机为什么会这样
但我的机就能看到
总之你把我的那段和你的那段对调就可以了
引用一下,自己懒得打,另附自己程序:
var a,b,d:integer;
c:boolean;
begin
randomize;b:=random(100);
repeat;
write('Please write a number 1-100:');
readln(a);d:=d+1;
if a if a>b then writeln('No,it is bigger');
if a=b then writeln('You are right thank you play QQ:932976500');
until (d=10)or(a=b);
if d=10 then writeln('Game Over');
readln;
end.

回答2:

既然答对了当然自动关闭!
而且你的程序限制了必须要在10次之内猜到,超过了10次当然就关闭了!
另外,你的程序并没有错,只是有一点小问题
if(j=10)and(h <> z)then;
writeln('you are fail, the number is',z);
end.
你不是判断完之后加了分号,就是说你的判断根本没用!
应该是:
if(j=10)and(h <> z)then
writeln('you are fail, the number is',z);
end.

我不知道你的机为什么会这样
但我的机就能看到
总之你把我的那段和你的那段对调就可以了

回答3:

你叫别人write('please input a number(0-11):');
而你自己却是z:=random(100);

一个是10,一个是100,那你当然就没有答对过拉
还有if(j=10)and(h <> z)then;
后面把分号删掉

回答4:

简单,只需要把前面read改成readln 然后在最后写个readln;即可。

另外write('please input a number(0-11):'); 应该不对!