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 60 61 62 63 64
|
program revente;
var
marchand, typeobjet, ro, competence, duree, prixfinal, prixinitial : Integer;
pourcentage : real;
begin
repeat
write('entrer le prix initial de lobjet a vendre : ');
readln (prixinitial);
until prixinitial>0;
repeat
write ('indiquer le type dobjet 11-armes classique 12-armes exotique 13-armures 14-bijoux 15-autres : ');
readln (typeobjet);
case typeobjet of
11 : pourcentage := 0.4;
12 : pourcentage := 0.3;
13 : pourcentage := 0.4;
15 : pourcentage := 0.45;
16 : pourcentage := 0.5;
else
writeln ('mauvais choix');
end;
until (typeobjet>10) and (typeobjet<16); { () indispensable }
repeat
write ('indiquer le type de marchands 1-honnete 2-filou 3-escroc : ');
readln (marchand);
case marchand of
1 : pourcentage:=pourcentage; {idéalement ici j'aimerai un random entre -0.05 et +0.05 mais je n'ai pas trouver comment faire...}
2 : pourcentage:=pourcentage-0.05;
3 : pourcentage:=pourcentage-0.15;
else
writeln ('mauvais choix');
end;
until (marchand>0) and (marchand<4);
repeat
Randomize;
writeln ('entrer la valeur de diplomatie ou de bluff');
pourcentage:= pourcentage+((competence+random(20))/200);
readln (competence);
until competence>-1;
repeat
write('entrer la duree consacrée en jours a la revente de l''objet :');
readln(duree);
case duree of
0 : pourcentage := pourcentage-0.1;
{1..15 : pourcentage;}
16..30 : pourcentage := pourcentage+0.02;
31..60 : pourcentage := pourcentage+0.04;
61..90 : pourcentage := pourcentage+0.07;
91..120 : pourcentage := pourcentage+0.1;
121..180 : pourcentage := pourcentage+0.13;
181..361 : pourcentage := pourcentage+0.20;
end;
until duree>-1;
end;
writeln (prixinitial*pourcentage);
readln;
end. |
Partager