Mi da:
Runtime error 2 at 0001:0346.
cioè?
Il listato (molto banale e magari anche sporco) è:
codice:
program indovinalo;
uses wincrt;
var numero,prova,tentativi,i,manche:integer;
a,b,ta,tb,err,risultante,resultscontenuto:string;
f:file;
begin;
clrscr;
a:=('Il numero e` un po` alto.. prova un po` di meno..');
b:=('Il numero e` un po` basso.. prova un po` di piu`..');
ta:=('Il numero e` TROPPO alto.. prova dalle 10 cifre in meno..');
tb:=('Il numero e` TROPPO basso.. prova dalle 10 cifre in piu`..');
err:=('Il numero incognito e` minore di 100!!!');
randomize;
write('Quante manche vuoi fare? ');
readln(manche);
for i:=1 to manche do
begin;
writeln('');
writeln('Manche ',i,' di ',manche,' :');
numero:=random(100);
tentativi:=0;
repeat
writeln('');
write('Prova ad indovinare il numero.. ');
readln(prova);
if prova>100 then writeln(err) else
if prova>numero+10 then writeln(ta) else
if prova>numero then writeln(a) else
if prova<numero-10 then writeln(tb) else
if prova<numero then writeln(b);
tentativi:=tentativi+1;
until prova=numero;
writeln('');
writeln('Congratulazioni.. L`hai azzeccato dopo ',tentativi-1,' tentativi.. il numero era ',numero,'!!!!!');
write('Inserisci il nick: ');
readln(risultante);
assign(f,'RESULTS');
reset(f);
{read(resultscontenuto);}
rewrite(f);
{write(resultscontenuto);}
write(risultante,(tentativi-1));
read(resultscontenuto);
close(f);
write(resultscontenuto)
end;
repeat until keypressed;
end.
Potete dirmi come correggerlo?
Graz' ciax..
PS: utilizzo TPW1.5.. Turbo Pascal per Windows della Borland International..