Advertisement
Guest User

Untitled

a guest
May 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. program jeu;
  2. uses wincrt;
  3. var
  4. mot:string;
  5. {*********************verif*************************}
  6. function verif (mot:string):boolean;
  7. var
  8. i:byte;
  9. v:boolean;
  10. Begin
  11. i:=0;
  12. v:=true;
  13. repeat
  14. i:=i+1;
  15. if not (mot[i] in ['A'..'Z','a'..'z']) then
  16. v:=false;
  17. until (v=false) or (i=length(mot));
  18. if length(mot)>20 Then
  19. v:=false;
  20. if length(mot)<5 then
  21. v:=false;
  22. verif:=v;
  23. end;
  24. {******************************masque***********************}
  25. function masque (mot:string):string;
  26. var
  27. n,i:byte;
  28. masque:string;
  29. Begin
  30. n:=length(mot)-1;
  31. for i:=2 to n do
  32. mot[i]:='-' ;
  33. masque:=mot
  34. end;
  35. procedure affiche (mot,masque:string);
  36. var
  37. c:char;
  38. nb,i:byte;
  39. begin
  40. nb:=length(mot);
  41. repeat
  42. writeln('le mot a deviner est :',masque);
  43. WriteLn('proposer une lettre');
  44. readln (c) ;
  45. for i:=2 to Length(mot)-1 do
  46. if upcase(c)=upcase(mot[i]) then
  47. masque[i]:=mot[i]
  48. and nb:=nb-1;
  49. WriteLn('il vous reste',nb,'essai');
  50. until (nb=0) or (masque=mot) ;
  51. if (masque=mot) then
  52. writeln('bravo! vous avez gangné')
  53. else
  54. writeln('désole,vous avez perdu');
  55. end;
  56. {*******************************pp**************************}
  57. Begin
  58. repeat
  59. writeln('sasir le mot à deviner:')
  60. readln(mot);
  61. until (verif(mot));
  62. ClrScr ;
  63. masque(mot);
  64. deviner(mot,masque);
  65. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement