TRUBO PASCAL的猜字谜程序(有提示和猜中后的答题次数)是三位数的

来源:百度知道 编辑:UC知道 时间:2024/06/04 03:35:49
要快,我们老师逼我们去做,必须是三位数以内的。谢谢!
噢!还有答题中要有提示。

var a,b,d:integer;
c:boolean;
begin
randomize;b:=random(999);
repeat;
write('Please write a number 1-999:');
readln(a);
if a<b then writeln('No,it is smaller');
if a>b then writeln('No,it is bigger');
if a=b then writeln('You are right!');
until a=b;
end.

楼上的不一定是3位数
program gamegues;
var
right,temp,i:integer;
begin
randomize;
right:=random(900)+100;
for i:=1 to 10 do
begin
readln(temp);
if temp>right then writeln('Too big.')
elses if temp<right then writeln('Too small.')
else
begin
writeln('You are right.You used ',i,' chance.');
readln;
halt;
end;
end;
writeln('Oh sorry.You have no chance.');
readln;
end.

var a,b,d:integer;
c:boolea