Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program jeu;
- uses wincrt;
- var
- mot:string;
- {*********************verif*************************}
- function verif (mot:string):boolean;
- var
- i:byte;
- v:boolean;
- Begin
- i:=0;
- v:=true;
- repeat
- i:=i+1;
- if not (mot[i] in ['A'..'Z','a'..'z']) then
- v:=false;
- until (v=false) or (i=length(mot));
- if length(mot)>20 Then
- v:=false;
- if length(mot)<5 then
- v:=false;
- verif:=v;
- end;
- {******************************masque***********************}
- function masque (mot:string):string;
- var
- n,i:byte;
- masque:string;
- Begin
- n:=length(mot)-1;
- for i:=2 to n do
- mot[i]:='-' ;
- masque:=mot
- end;
- procedure affiche (mot,masque:string);
- var
- c:char;
- nb,i:byte;
- begin
- nb:=length(mot);
- repeat
- writeln('le mot a deviner est :',masque);
- WriteLn('proposer une lettre');
- readln (c) ;
- for i:=2 to Length(mot)-1 do
- if upcase(c)=upcase(mot[i]) then
- masque[i]:=mot[i]
- and nb:=nb-1;
- WriteLn('il vous reste',nb,'essai');
- until (nb=0) or (masque=mot) ;
- if (masque=mot) then
- writeln('bravo! vous avez gangné')
- else
- writeln('désole,vous avez perdu');
- end;
- {*******************************pp**************************}
- Begin
- repeat
- writeln('sasir le mot à deviner:')
- readln(mot);
- until (verif(mot));
- ClrScr ;
- masque(mot);
- deviner(mot,masque);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement