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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
|
program locationdevoiture;
uses wincrt;
type auto = record
nom:string;
nplace:integer;
prix:real; {prix de location par jour}
end;
clients = record
nom : string;
voitloue : string;
dure : integer;
prixloc : real;
end;
var
liste1 : array[0..10] of auto;
liste2 : array[0..10] of clients;
automobile : file of auto;
clientelle : file of clients;
jour,moi,annee,jours,mois,annees:integer;
nbjours,jo:integer;
nbvoiture:integer;
nb:integer;
clientt:string;
function numjours(jo,moi:integer):integer;{jour de loc }
var nb:integer;
begin
if moi=1 then nb:=0;
if moi=2 then nb:=31;
if moi=3 then nb:=31+28;
if moi=4 then nb:=31+28+31;
if moi=5 then nb:=31+28+31+30;
if moi=6 then nb:=31+28+31+30+31;
if moi=7 then nb:=31+28+31+30+31+30;
if moi=8 then nb:=31+28+31+30+31+30+31;
if moi=9 then nb:=31+28+31+30+31+30+31+30;
if moi=10 then nb:=31+28+31+30+31+30+31+30+31;
if moi=11 then nb:=31+28+31+30+31+30+31+30+31+30;
if moi=12 then nb:=31+28+31+30+31+30+31+30+31+30+31;
numjours:=jo+nb;
end;
procedure affichagevoiture;
var i:integer;
begin
assign(automobile,'f:\bureau~1\tc3\auto');
reset(automobile);
writeln(' *************** Liste des voitures ***************');
for i:=1 to 4 do
begin
writeln(' Choix n°',i);
writeln('voiture : ',liste1[i].nom);
writeln('nombre de places : ',liste1[i].nplace);
writeln('prix de location : ',liste1[i].prix:0:1,' euros');
end;
end;
procedure affichageclients;
var i:integer;
begin
assign(clientelle,'f:\bureau~1\tc3\clients');
reset(automobile);
writeln(' *************** Liste des voitures ***************');
for i:=1 to 4 do
begin
writeln('n°',i,' : ',liste2[i].nom);
end;
end;
{var
liste :array[1..10] of auto;
voiture :auto;
i:integer;
choix, n, j, duree, m, nbv :integer;
apayer :real;
automobile: file of auto;
client:string; }
begin
affichagevoiture;
affichageclients;
writeln('********************************************************************************');
writeln;
writeln(' LOCATION ');
writeln;
writeln('********************************************************************************');
writeln(' ');
writeln;
writeln;
writeln(' ******** entrez les dates de location (jj/mm/aa) ********');
writeln;
writeln(' ----- Date de sortie de la voiture -----');
writeln;
write('entrez le jour :');readln(jour);
write('entrez le moi :');readln(moi);
write('entrez l''année :');readln(annee);
writeln;
writeln(' ----- Date de rentrée de la voiture -----');
writeln;
write('entrez le jour :');readln(jours);
write('entrez le moi :');readln(mois);
write('entrez l''année :');readln(annees);
nbjours:=365*(annees-annee)+numjours(jours,mois)-numjours(jour,moi);
writeln('nombre de jour ',nbjours);
writeln(' * * * * * * * * fiche location * * * * * * * *');
writeln;
write('Location au nom de : M./Mme ');read(clientt);
{ writeln('Voiture louée : ',liste1[i].nom);}
write('Date : du ',jour,'/',moi,'/',annee);
writeln(' au ',jours,'/',mois,'/',annees);
writeln('nombre de jour(s) de location ',nbjours);
{ writeln('prix a payer : ',nbjours*liste[choix].prix:0:2,' euro'); }
end.
base de donnée séparées automobile et clientelles
program autom;
uses wincrt;
type auto=record
nom:string;
nplace:integer;
dateloc,dateren,vidange,revision:integer;
prixloc:real;
client:string;
end;
var
automobile: file of auto;
liste1 : array[1..10] of auto;
i:integer;
begin
assign(automobile,'f:\bureau~1\tc3\auto');
reset(automobile);
{audi}
liste1[1].nom:='audi';
liste1[1].nplace:=5;
liste1[1].prixloc:=350;
{porche}
liste1[2].nom:='porsche';
liste1[2].nplace:=2;
liste1[2].prixloc:=400;
{jaguar}
liste1[3].nom:='jaguar';
liste1[3].nplace:=2;
liste1[3].prixloc:=450;
{ferrari}
liste1[4].nom:='ferrari';
liste1[4].nplace:=2;
liste1[4].prixloc:=500;
for i:=1 to 4 do
begin
write(automobile,liste1[i]);
end;
close(automobile);
writeln('ok');
end.
program client;
uses wincrt;
type clients=record
nom:string;
voitloue:string;
dure:integer;
prixloc:real;
end;
var
clientelle: file of clients;
liste2 : array[1..10] of clients;
o:integer;
begin
assign(clientelle,'f:\bureau~1\tc3\clients');
reset(clientelle);
rewrite(clientelle);
{Legrand}
liste2[1].nom:='Mr Legrand';
liste2[1].voitloue:='a';
liste2[1].prixloc:=0;
liste2[1].dure:=0;
{Pouchoux}
liste2[2].nom:='Mr Pouchoux';
liste2[2].voitloue:='a';
liste2[2].prixloc:=0;
liste2[2].dure:=0;
{Virol}
liste2[3].nom:='Mr Virol';
liste2[3].voitloue:='a';
liste2[3].prixloc:=0;
liste2[3].dure:=0;
{Ripka}
liste2[4].nom:='Mr Ripka';
liste2[4].voitloue:='a';
liste2[4].prixloc:=0;
liste2[4].dure:=0;
for o:=1 to 4 do
begin
write(clientelle,liste2[o]);
end;
close(clientelle);
end. |
Partager