jeux pour vous ????? - Delphi/Pascal - Programmation
MarshPosté le 27-01-2008 à 11:13:06
salut , tester cette jeux
program jeux; uses wincrt; const mot= 'ounis'; var c:integer; reponse,ch:string; procedure jx(var reponse:string;var ch:string ; mot:string); var i,f,c,k,t:integer; begin
mot:='ounis'; i:=1; t:=0; for f:= 1 to 5 do begin repeat writeln('donner la solution ,l''essai n°',f); readln(reponse); until(length(reponse)<=5); t:=0; for i := 1 to 5 do
begin
if mot[i] = reponse[i] then
ch[i]:=reponse[i]
else ch[i]:='*';
end;
write('lettres trouvées sont '); for c := 1 to 5 do begin write(ch[c]); end; writeln(' ');
for k := 1 to 5 do
begin if (ch[k]='*') then t:=1; end;
if t=0 then begin writeln('Bravo?????'); exit; end;
end;
if ((i=5) and (t=1)) then writeln('Pas mot!!!!!!!');
Marsh Posté le 27-01-2008 à 11:13:06
salut ,
tester cette jeux
program jeux;
uses wincrt;
const
mot= 'ounis';
var
c:integer;
reponse,ch:string;
procedure jx(var reponse:string;var ch:string ; mot:string);
var
i,f,c,k,t:integer;
begin
mot:='ounis';
i:=1;
t:=0;
for f:= 1 to 5 do
begin
repeat
writeln('donner la solution ,l''essai n°',f);
readln(reponse);
until(length(reponse)<=5);
t:=0;
for i := 1 to 5 do
begin
if mot[i] = reponse[i] then
ch[i]:=reponse[i]
else
ch[i]:='*';
end;
write('lettres trouvées sont ');
for c := 1 to 5 do
begin
write(ch[c]);
end;
writeln(' ');
for k := 1 to 5 do
begin
if (ch[k]='*') then
t:=1;
end;
if t=0 then
begin
writeln('Bravo?????');
exit;
end;
end;
if ((i=5) and (t=1)) then
writeln('Pas mot!!!!!!!');
end;
BEGIN
jx(reponse,ch,mot);
end.