1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| program chez_la_fourmi;
uses wincrt;
var d,c,jp,ji:integer; p:string; j:real;
begin
repeat
writeln('pair(2) ou impair(1) ???');
readln(p);
until
(p='1') or (p='2');
jp:=0;
ji:=0;
if p='1' then
writeln('vous jouez impair',chr(13))
else
writeln('vous jouez pair',chr(13));
for c:=1 to 5 do {10 c'est trop}
begin
repeat
writeln('combien de doigts ?');
readln(j);
until
trunc(j) in [1..5];
d:=random(5);
writeln(d);
if (trunc(j)+d) mod 2=0 then
begin
writeln('resultat : ',trunc(j)+d,', c''est pair',chr(13));
jp:=jp+1
end
else
begin
writeln('resultat : ',trunc(j)+d,', c''est impair',chr(13));
ji:=ji+1
end
end;
If ji=jp then
writeln('EGALITE');
If ((p='1') and (ji>jp)) or ((p='2') and (jp>ji)) then
writeln(' Vous avez gagné! :)')
else
writeln(' Vous avez perdu! :(');
If p='1' then
writeln('SCORE : Humain ',ji,' - ',jp,' Ordinateur');
If p='2' then
writeln('SCORE : Humain ',jp,' - ',ji,' Ordinateur');
end. |
Partager