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 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
| program projet;
uses crt;
var recommencer: char;
nsec:integer;
PROCEDURE conv;
var m,h:integer;
begin
m:=(nsec div 60) mod 60;
h:=nsec div 3600;
writeln(h,' heures ',m,' min ');
end;
PROCEDURE entree_multi;
var dbm:text;
pieds:integer;
nbr_ref:integer;
nbr,rapport:integer;
begin
assign(dbm,'C:\tp7\source\dbm.txt');
append(dbm);
writeln;
writeln('Multi-reference');
writeln('----------------');
writeln;
writeln('Quelle etait la taille du conteneur? 20-25-40 pieds?');
readln(pieds);
writeln(dbm,pieds);
writeln('Combien de references differentes y avait-il?');
readln(nbr_ref);
writeln(dbm,nbr_ref);
writeln('Combien de temps le dechargement a-t-il pris?');
readln(nsec);
nsec:=nsec*60;
writeln('Combien de personnes ont decharge?');
readln(nbr);
rapport:=nsec*nbr;
writeln(dbm,rapport);
close(dbm)
end;
PROCEDURE entree;
var
db:text;
nombre,y,temps,rapport,pieds,colis,poids:integer;
choix:char;
begin
writeln;
writeln('1. Simple ref');
writeln('2. Multi-ref');
readln(choix);
case choix of
'2' : entree_multi;
'1' : begin
assign(db,'C:\tp7\source\db.txt');
append(db);
writeln;
writeln('Quelle etait la capacite du conteneur? 20-25-40');
readln(pieds);
writeln(db,pieds);
writeln;
writeln('Combien de colis y avait-il?');
readln(colis);
writeln(db,colis);
writeln;
writeln('Quel etait le poids du conteneur?');
readln(poids);
writeln(db,poids);
writeln;
writeln('Entrez le temps mis (en minutes)');
readln(nsec);
nsec:=nsec*60;
writeln;
writeln('Entrez le nombre de personnel');
readln(nombre);
rapport:=nsec*nombre;
writeln(db,rapport);
close(db);
writeln
end
end
end;
PROCEDURE calcul;
var
db:text;
pieds,colis,poids,pieds1,colis1,poids1:integer;
nbr_pal,nombre,i,rapport,rapport1,rapport2,x:integer;
choix1,choix2:char;
begin
x:=0;
rapport1:=0;
writeln;
writeln('Prevision');
writeln;
writeln('Y a-t-il des conteneurs a decharger?');
writeln('1. Oui');
writeln('2. Non');
readln(choix1);
case choix1 of
'1' : begin
writeln('Combien de conteneurs arrivent ce jour?');
readln(nombre);
rapport2:=0;
for i:=1 to nombre do
begin
writeln;
textcolor(brown);
writeln('Conteneur ', i);
writeln('--------------');
textcolor(black);
writeln('Est-ce un 20, 25 ou 40 pieds?');
readln(pieds1);
writeln('Combien de colis y a-t-il?');
readln(colis1);
writeln('Quel est le poids du conteneur?');
readln(poids1);
writeln;
assign(db,'C:\tp7\source\db.txt');
reset(db);
while not eof(db) do
begin
readln(db,pieds);
if pieds=pieds1 then
begin
readln(db,colis);
if ((colis-colis1<150) and (colis-colis1>-150)) then
begin
readln(db,poids);
if ((poids-poids1<200) and (poids-poids1>-200)) then
begin
readln(db,rapport);
rapport1:=rapport1+rapport;
x:=x+1
end
end
end
end;
if rapport1=0 then
begin
textcolor(red);
writeln('Ce type de conteneur est absent dans la base de donnees');
textcolor(black)
end
else
begin
rapport1:=rapport1 div x;
rapport2:=rapport2+rapport1
end;
end;
if rapport2 <> 0 then
begin
writeln;
writeln('Estimation terminee.');
nsec:=rapport2 div 2;
write('Le temps estime pour deux ouvriers est de ');
conv;
nsec:=rapport2 div 3;
write('Le temps estime pour trois ouvriers est de ');
conv;
nsec:=rapport2 div 4;
write('Le temps estime pour quatre ouvriers est de ');
conv;
nsec:=rapport2 div 5;
write('Le temps estime pour cinq ouvriers est de ');
conv;
writeln
end;
close(db);
end;
'2' : rapport2:=0
end;
writeln;
writeln('Y a-t-il des palettes a descendre et filmer+bande de garantie?');
writeln('1. Oui ');
writeln('2. Non ');
readln(choix2);
case choix2 of
'1' : begin
nsec:=270; (*temps de film+bande par palette et par personne*)
writeln('Combien?');
readln(nbr_pal);
rapport2:=rapport2+(nsec*nbr_pal);
writeln;
writeln('Estimation terminee.');
nsec:=rapport2 div 2;
write('Le temps estime pour deux ouvriers est de ');
conv;
nsec:=rapport2 div 3;
write('Le temps estime pour trois ouvriers est de ');
conv;
nsec:=rapport2 div 4;
write('Le temps estime pour quatre ouvriers est de ');
conv;
nsec:=rapport2 div 5;
write('Le temps estime pour cinq ouvriers est de ');
conv;
writeln
end
end
end;
PROCEDURE affichage_multi;
var
dbm:text;
pieds,nbr_ref:integer;
begin
assign(dbm,'C:\tp7\source\dbm.txt');
reset(dbm);
textcolor(red);
writeln('Appuyez sur une touche pour afficher les donnees suivantes');
textcolor(black);
while not eof(dbm) do
begin
writeln;
write('pieds: ');
readln(dbm,pieds);
textcolor(green);
writeln(pieds);
textcolor(black);
write('nombre de ref: ');
readln(dbm,nbr_ref);
textcolor(green);
writeln(nbr_ref);
textcolor(black);
write('Temps qu aurait mis une seule personne: ');
readln(dbm,nsec);
textcolor(green);
conv;
textcolor(black);
readkey
end;
writeln;
writeln('Remarque: le temps qu aurait mis une personne n est pas du tout prcis.');
writeln('Une personne mettrait en realite beaucoup plus de temps');
writeln('La donnee est presente a titre indicatif');
end;
PROCEDURE affichage;
var
db:text;
pieds,colis,poids:integer;
choix:char;
begin
writeln;
writeln('1. Simple ref');
writeln('2. Multi-ref');
readln(choix);
case choix of
'2' : affichage_multi;
'1' : begin
assign(db,'C:\tp7\source\db.txt');
reset(db);
textcolor(red);
writeln('Appuyez sur une touche pour afficher les donnees suivantes');
textcolor(black);
while not eof(db)do
begin
writeln;
write('pieds: ');
readln(db,pieds);
textcolor(green);
writeln(pieds);
textcolor(black);
write('colis: ');
readln(db,colis);
textcolor(green);
writeln(colis);
textcolor(black);
write('Poids: ');
readln(db,poids);
textcolor(green);
writeln(poids);
textcolor(black);
write('Temps qu aurait mis une seule personne: ');
readln(db,nsec);
textcolor(green);
conv;
textcolor(black);
readkey
end;
writeln;
writeln('Remarque: le temps qu aurait mis une personne n est pas du tout prcis.');
writeln('Une personne mettrait en realite beaucoup plus de temps');
writeln('La donnee est presente a titre indicatif')
end
end
end;
PROCEDURE clear;
var
choix,clear:char;
dbm,db:text;
begin
writeln;
writeln('1. Simple ref');
writeln('2. Multi-ref');
readln(choix);
case choix of
'1' : begin
writeln('Voulez-vous remettre la base de donnees a zero? O/N');
readln(clear);
if clear='o' then
begin
assign(db,'C:\tp7\source\db.txt');
rewrite(db);
close(db)
end
end;
'2' : begin
writeln('Voulez-vous remettre la base de donnees a zero? O/N');
readln(clear);
if clear='o' then
begin
assign(dbm,'C:\tp7\source\dbm.txt');
rewrite(dbm);
close(dbm)
end
end
end
end;
PROCEDURE menu;
var
choix:char;
begin
clrscr;
writeln;
writeln(' ________________');
writeln(' | MENU |');
writeln(' |______________|');
writeln;
writeln;
writeln('1. Entree de donnees');
writeln('2. Calcul prvisionnel');
writeln('3. Affichage de la base de donnees');
writeln('4. Remise a zero de la base de donnees /!\ ');
writeln;
writeln;
writeln;
textcolor(lightgreen);
writeln('Pour la prevision de multi-ref:');
writeln('Il est conseille de consulter la base de donnees et de se baser dessus');
textcolor(black);
writeln;
readln(choix);
case choix of
'1' : entree;
'2' : calcul;
'3' : affichage;
'4' : clear;
end;
end;
begin
repeat
textbackground(white);
textcolor(black);
menu;
writeln;
textcolor(red);
writeln('Refaire une operation? o/n');
readln(recommencer);
until recommencer='n'
end. |
Partager