求PASCAL源程序:(猜拳)

来源:百度知道 编辑:UC知道 时间:2024/05/21 06:20:41
编一程序实现人和计算机玩"石头, 剪子, 布"这个猜拳游戏. 计算机用随机方法出拳, 人的则由键盘输入. 谁先胜三盘就算谁赢.

急!

program lklk;
var a:string;
b:integer;
i:longint;
k,n:longint;
begin
repeat
readln(a);
b:=random(2);
if b=0 then
begin
if a='jiandao' then inc(k);
if a='shitou' then inc(i);
if a='bu' then inc(n);
end;
if b=1 then
begin
if a='jiandao' then inc(i);
if a='shitou' then inc(n);
if a='bu' then inc(k);
end;
if b=2 then
begin
if a='jiandao' then inc(n);
if a='shitou' then inc(k);
if a='bu' then inc(i);
end;
until (k=3) or (n=3);
if k=3 then writeln('You lose!');
if n=3 then writeln('You win!');
end.

把输入输出格式给一下OK?