Program S12;
Var
mot1,mot2,ch : string;
nb,score1,score2 : integer;
//********************************
Procedure generer (Var ch:String);
Var
i : integer;
Begin
ch := '';
randomize;
For i:=1 To 10 Do
ch := ch+chr(random(26)+ord('A'));
End;
//********************************
Function verif(mot,ch:String) : boolean;
Var
i : integer;
choix : char;
ok : boolean;
Begin
ok := true;
For i:=1 To length(mot) Do
If (pos(mot[i],ch)=0) Then
ok := false;
Repeat
write('le mot existe dans la langue française O/N?:');
readln(choix);
choix := upcase(choix);
Until (choix In ['O','N']);
verif := (choix='O')And(ok);
End;
//********************************
Begin
nb := 0;
score1 := 0;
score2 := 0;
Repeat
nb := nb+1;
writeln('Tour ',nb);
generer(ch);
writeln('les 10 letteres sont:',ch);
write('donner la proposition du joueur1:');
readln(mot1);
If (verif(mot1,ch)) Then
score1 := score1+length(mot1);
write('donner la proposition du joueur2:');
readln(mot2);
If (verif(mot2,ch)) Then
score2 := score2+length(mot2);
Until ((score1>=15)Or(score2>=15));
writeln('score joueur1:',score1);
writeln('score joueur 2:',score2);
If (score1=score2) Then
writeln('Egalité entre les deux joeurs')
Else If (score1>score2) Then
writeln('c''est le premier joeur qui a gagné')
Else
writeln('c''est le deuxième joeur qui a gagné');
End.
Inscription à :
Publier les commentaires (Atom)