Pascal! Ajuda

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

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.
 
e se usares o repeat ou a estrutura while.

tipo no final o program pergunta ao utilizador quer voltar a jogar e o utilizador dizer que sim repete tudo de novo se dizer que nao fecha.
 
mas isso foi o qe eu fiz .. -.-
o meu primo ainda me disse para por o fim de linha, ou seja, o enter, qe é \n em C, mas ele n sabe como é em pascal
 
Back
Topo