tiagomdv
Power Member
entao é assim, eu qeria qe no final do programa, ele pedisse para carregar S para repetir, só que se eu ponho "until ( c = 's' )" ele continua com todas, e se ponho "until ( c <> 's' )" ele acaba com todas -.-
Sera qe podiam dar uma olhadela para ver o qe fiz de mal??
obrigado desde ja =D
Sera qe podiam dar uma olhadela para ver o qe fiz de mal??
obrigado desde ja =D
Código:
program Descobre_o_numero_correcto;
uses crt;
var n, r : integer;
cont:integer;
c : char;
begin
repeat
sound(1000);
delay(10000);
randomize;
R := random(50);
textbackground(blue);
clrscr;
textcolor(red);
textbackground(red);
write ('........................................................................................');
textcolor(white);
write ('Escolhe um numero de 0 a 50 com o minimo de tentativas possiveis');
textcolor(red);
textbackground(red);
write ('........................................................................................');
writeln;
textcolor(white);
textbackground(blue);
write ('Pressione Qualquer Tecla Para Continuar');
readkey;
writeln;
textcolor(yellow);
sound(2000);
delay(1000);
nosound;
write ('Escolhe um numero = ');
read (n);
if n > R then
begin
writeln;
textcolor(red);
writeln;
textcolor(white);
write ('Escolhe numeros mais pequenos! ');
writeln;
end
else
begin
writeln;
textcolor(red);
textcolor(white);
nosound;
write ('Escolhe numeros maiores!');
writeln;
end;
cont:=1;
if n = R then
begin
textcolor(yellow);
write ('Parabens! Acertaste a primeira cod=2097');
readkey;
end
else
begin
repeat
if n>50 then
begin
textcolor(white);
writeln; sound(100);
delay(10000);
nosound;
write ('Apenas numeros de 0 a 50!');
end;
writeln;
textcolor(yellow);
write ('Errado! Escolhe outro numero = ');
sound(2000);
delay(1000);
nosound;
read (n);
cont:= cont+1;
if n > R then
begin
writeln;
textcolor(red);
writeln;
textcolor(white);
write ('Escolhe numeros mais pequenos! ');
writeln;
end
else
begin
writeln;
textcolor(red);
textcolor(white);
nosound;
write ('Escolhe numeros maiores!');
writeln;
end;
until n = R;
clrscr;
textcolor(white);
sound(4000);
delay(1000);
nosound;
write ('Boa! Acertaste em ',cont,' tentativas');
writeln;
textcolor(green);
write ('Pressione "S" se deseja voltar a jogar = ');
readln (c);
end;
until ( c = 's' )
end.