viết chương trình trò chơi oẳn tù tì gợi ý bên máy ra: mr:=random(3); if mr=0 then mc:=’keo’; if mr=1 then mc:=’bua’; if mr=2 then mc=’bao’;

viết chương trình trò chơi oẳn tù tì
gợi ý bên máy ra:
mr:=random(3);
if mr=0 then mc:=’keo’;
if mr=1 then mc:=’bua’;
if mr=2 then mc=’bao’;

0 bình luận về “viết chương trình trò chơi oẳn tù tì gợi ý bên máy ra: mr:=random(3); if mr=0 then mc:=’keo’; if mr=1 then mc:=’bua’; if mr=2 then mc=’bao’;”

  1. program Keo_Bua_Bao;
    uses crt;
    var c1, l, mc, nc, man, tg: integer;
    var t1, mr, nr: string;
    begin
    clrscr;
    textcolor (white+blink);
    delay (1000);
    clrscr;
    gotoxy (39,9);
    textcolor (lightblue+blink);
    delay (1500);
    l:=0;
    begin
    repeat
    textcolor (white);
    l:=l+1;
    gotoxy (35,13);
    writeln (‘LOADING ‘,l,’ %’);
    delay (50);
    clrscr;
    if l=100 then
    delay (1000);
    until l=100;
    end;
    begin
    t1:=’||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||’;
    for l:=1 to length(t1) do
    begin
    gotoxy (10,30);
    write (t1[l]);
    delay(30);
    end;
    end;
    begin
    clrscr;
    textcolor (lightgreen+blink);
    repeat
    writeln (‘CHAO MUNG DEN VOI TRO CHOI KEO BUA BAO’);
    textcolor (white);
    writeln (‘1.Start’);
    writeln (‘2.Huong dan’);
    writeln (‘3.Exit’);
    write (‘Ban chon: ‘);
    readln (c1);
    if c1=1 then
    begin
    clrscr;
    { man:=1;
    begin
    writeln (‘man ‘,man); }
    { if man=1 then }
    repeat
    clrscr;
    begin
    randomize;
    mc:=random (3);
    if mc=0 then
    mr:=’keo’;
    if mc=1 then
    mr:=’bua’;
    if mc=2 then
    mr:=’bao’;
    end;
    begin
    write (‘ban muon su dung (1.keo) (2.bua) (3.bao): ‘);
    readln (nc);
    if nc=1 then
    nr:=’keo’;
    if nc=2 then
    nr:=’bua’;
    if nc=3 then
    nr:=’bao’;
    end;
    writeln (‘may ra ‘,mr);
    writeln (‘ban ra ‘,nr);
    if (mr=’keo’) and (nr=’keo’) then
    begin
    writeln (‘HOA NHAU’);
    tg:=1;
    end;
    if (mr=’bua’) and (nr=’bua’) then
    begin
    writeln (‘HOA NHAU’);
    tg:=1;
    end;
    if (mr=’bao’) and (nr=’bao’) then
    begin
    writeln (‘HOA NHAU’);
    tg:=1;
    end;
    { if (nr=’keo’) and (mr=’keo’) then
    begin
    writeln (‘HOA NHAU’);
    tg:=1;
    end;
    if (nr=’bua’) and (mr=’bua’) then
    begin
    writeln (‘HOA NHAU’);
    tg:=1;
    end;
    if (nr=’bao’) and (mr=’bao’) then
    begin
    writeln (‘HOA NHAU’);
    tg:=1;
    end; }
    if (mr=’keo’) and (nr=’bua’) then
    begin
    writeln (‘BAN THANG’);
    tg:=2;
    end;
    if (mr=’bua’) and (nr=’bao’) then
    begin
    writeln (‘BAN THANG’);
    tg:=2;
    end;
    if (mr=’bao’) and (nr=’keo’) then
    begin
    writeln (‘BAN THANG’);
    tg:=2;
    end;
    if (nr=’keo’) and (mr=’bua’) then
    begin
    writeln (‘BAN THUA’);
    tg:=2;
    end;
    if (nr=’bua’) and (mr=’bao’) then
    begin
    writeln (‘BAN THUA’);
    tg:=2;
    end;
    if (nr=’bao’) and (mr=’keo’) then
    begin
    writeln (‘BAN THUA’);
    tg:=2;
    end;
    until tg=2;
    end;
    if c1=2 then
    begin
    clrscr;
    textcolor (lightgreen+blink);
    delay (50);
    writeln (‘ CHAO MUNG BAN DEN VOI TRO CHOI KEO BUA BAO’);
    delay (50);
    textcolor (white);
    writeln (‘Ban phai chon 1 trong 3 so tuong ung voi vat dung ma ban muon su dung (1=keo)’);
    delay (50);
    writeln (‘(2=bao) (3=bua)’);
    delay (50);
    writeln (‘CHUC BAN MAY MAN !!!’);
    textcolor (100);
    readln;
    exit;
    end;
    if c1=3 then
    exit;
    if (c1<>1) and (c1<>2) and (c1<>3) then
    begin
    clrscr;
    writeln (‘chon ko phu hop’);
    readln;
    clrscr;
    end;
    until (tg=2) or (c1=3);
    end;
    readln;
    end. 

    code này mình có sẵn trong máy nên….

    Bình luận

Viết một bình luận