Oggi il prof ci ha detto che il programma del guscio precedentemente pubblicato non andava bene così ci ha affiancati ai ragazzi di 4^b che ci hanno fornito il programma più esatto:
program TORERO;
var i,o:text;
s:string;
j,h,k,n,m,q:integer;
begin
randomize;
assign(i,'input.txt');
reset(i);
assign(o,'output.txt');
rewrite(o);
read(i,n);
read (i,m);
read(i,q);
for j:=1 to m do begin read (i,h);
read(i,k);
end;
writeln(o,trunc(random(q+1)));
close(i); close (o);
end.
Sul desktop bisogna creare il file "input.txt" contenente:
4 5 2
1 3
1 4
3 2
3 4
4 2
program TORERO;
var i,o:text;
s:string;
j,h,k,n,m,q:integer;
begin
randomize;
assign(i,'input.txt');
reset(i);
assign(o,'output.txt');
rewrite(o);
read(i,n);
read (i,m);
read(i,q);
for j:=1 to m do begin read (i,h);
read(i,k);
end;
writeln(o,trunc(random(q+1)));
close(i); close (o);
end.
Sul desktop bisogna creare il file "input.txt" contenente:
4 5 2
1 3
1 4
3 2
3 4
4 2


0 Comments:
Posta un commento
<< Home