1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
var
type ville=record
nomdeville:string;
population:longint;
nombredecas:longint;
end;{record}
var liste:array[1..10] of ville;
i:longint;
continu:char;
villenum:longint;
semaine:longint;
******************************************************
function TestVivant ():boolean;
var
cpt : integer;
test:boolean;
begin
test=false;
for cpt:=1 to 10 do
begin
if liste[cpt].nombredecas<>liste[cpt].population then
test:=true;
end;
return test;
end;
******************************************************
procedure epidemie();
var
reste:integer;
villenum:integer;
begin
villennum:=random(10)+1;
reste:=liste[villeenum].population-liste[villenum].nombredecas;
liste[villenum].nombredecas:=
liste[villenum].nombredecas+(random(reste)+1);
end;
******************************************************
/////////////////////////////////////////////
begin
continu:=o;
while (TestVivant=true and continu="o" ) do
begin
epidemie();
semaine=semaine+1;
writeln(semaine numero: "+semaine);
for i:=1 to 10 do
begin
writeln ("Ville "+Liste[i].nomdeville+"Population: "+
Liste[i].population+"Infectes: "+Liste[i].nombredecas);
end;
writeln ("Voulez vous continuer?(o/n)");
readln (continu);
end;
end; |
Partager