Advertisement
ProToTN

Affecter_place_vehicule

Dec 20th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. void Affecter_place_vehicule (Vehicule mat[9][5],int voitures,int camions)
  2. {
  3.     int i,j,x=0;
  4.     Vehicule e;
  5.     for(i=0;i<9; i++)
  6.     {
  7.         for(j=0 ; j<5 ; j++)
  8.         {
  9.             if ((mat[i][j].type==0) && (x==0))
  10.             {
  11.                 e=Saisir_vehicule(e);
  12.                 if (e.type==1){
  13.                     if (voitures>0){
  14.                         x=1;
  15.                         mat[i][j]=e;
  16.                         voitures--;
  17.                     }
  18.                     else if (camions>5){
  19.                         x=1;
  20.                         mat[i][j]=e;
  21.                         voitures--;
  22.                     }
  23.                 }
  24.                 else (e.type==2){
  25.                     if ((camions>0)){
  26.                         x=1;
  27.                         mat[i][j]=e;
  28.                         camions--;
  29.                     }
  30.                 }
  31.             }
  32.            
  33.  
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement