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
|
program revente;
var marchand,typeobjet,ro,competence,duree,prixfinal,prixinitial: integer;
pourcentage: real;
begin
repeat
writeln ('entrer le prix initial de lobjet a vendre');
readln (prixinitial);
until prixinitial>0;
repeat
writeln ('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;
then
writeln ('mauvais choix');
end;
until typeobjet>10 and typeobjet<16;
repeat
writeln ('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;
then
writeln ('mauvais choix');
end;
until marchand>0 and marchand<4;
repeat
Randomize;
writeln ('entrer la valeur de diplomatie ou de bluff');
pourcentage:= pourcentage+((competence+rand(20))/200);
readln (competence);
until comp>-1;
repeat
writeln ('entrer la duree consacrée en jours a la revente de lobjet');
readln (duree);
case duree of
'0':pourcentage-0.1;
'>0 and <16' :pourcentage;
'>15 and <31' : pourcentage:= pourcentage+0.02;
'>30 and <61' : pourcentage:= pourcentage+0.04;
'>60 and <91' : pourcentage:= pourcentage+0.07;
'>90 and <121' : pourcentage:= pourcentage+0.1;
'>120 and <181' : pourcentage:= pourcentage+0.13;
'>180 and <361' : pourcentage:= pourcentage+0.20;
end;
until duree>-1;
end;
writeln (prixinitial*pourcentage);
readln;
end. |
Partager