

program keo_bua_bao;
uses crt;
var a,q,w,n:integer;
b,c,f,s:string;
begin
clrscr;
a:=1;
writeln('Tac gia Truong Dinh Quang');
writeln('Xin chao! Choi ngay thoi!!!');
write('Nhan 1 de choi ');
readln(n);
if n=1 then
begin
while a=1 do
begin
clrscr;
writeln('Ban chon gi?');
writeln('1: keo');
writeln('2: bua');
writeln('3: bao');
readln(q);
randomize;
w:=random(4);
if w=1 then b:='keo';
if w=2 then b:='bua';
if w=3 then b:='bao';
if q=1 then c:='keo';
if q=2 then c:='bua';
if q=3 then c:='bao';
if w=q then f:='Hoa!';
if w=1 then
begin
if q=2 then f:='Ban thang!';
if q=3 then f:='Ban thua!';
end;
if w=2 then
begin
if q=3 then f:='Ban thang!';
if q=1 then f:='Ban thua!';
end;
if w=3 then
begin
if q=1 then f:='Ban thang!';
if q=2 then f:='Ban thua!';
end;
clrscr;
writeln('May chon: ',b);
writeln('Ban chon: ',c);
writeln(f);
delay(2000);
writeln;
write('Nhan K+Enter de ket thuc, nhan Enter de tiep tuc ');
readln(s);
if s='k' then a:=2;
end;
end;
end.
uses crt;
var a,q,w,n:integer;
b,c,f,s:string;
begin
clrscr;
a:=1;
writeln('Tac gia Truong Dinh Quang');
writeln('Xin chao! Choi ngay thoi!!!');
write('Nhan 1 de choi ');
readln(n);
if n=1 then
begin
while a=1 do
begin
clrscr;
writeln('Ban chon gi?');
writeln('1: keo');
writeln('2: bua');
writeln('3: bao');
readln(q);
randomize;
w:=random(4);
if w=1 then b:='keo';
if w=2 then b:='bua';
if w=3 then b:='bao';
if q=1 then c:='keo';
if q=2 then c:='bua';
if q=3 then c:='bao';
if w=q then f:='Hoa!';
if w=1 then
begin
if q=2 then f:='Ban thang!';
if q=3 then f:='Ban thua!';
end;
if w=2 then
begin
if q=3 then f:='Ban thang!';
if q=1 then f:='Ban thua!';
end;
if w=3 then
begin
if q=1 then f:='Ban thang!';
if q=2 then f:='Ban thua!';
end;
clrscr;
writeln('May chon: ',b);
writeln('Ban chon: ',c);
writeln(f);
delay(2000);
writeln;
write('Nhan K+Enter de ket thuc, nhan Enter de tiep tuc ');
readln(s);
if s='k' then a:=2;
end;
end;
end.