fellipeh

Untitled

Jul 13th, 2020
1,160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.86 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int estacionamento [0][0];
  5.  
  6. int menu();
  7. void listar_vagas();
  8. bool remover_carro(int id_do_carro);
  9. bool estacionar(char tipo_de_carro);
  10. bool verifica_vaga_diponivel(int andar);
  11.  
  12. int main(){
  13.  
  14.     int const ANDAR = 2;
  15.     int const VAGAS = 10;
  16.  
  17.     int estacionamento [ANDAR][VAGAS];
  18.  
  19.     menu();
  20.  
  21.  
  22.     return 0;
  23. }
  24.  
  25. bool estacionar(int tipo_de_carro){
  26.  
  27.     return true;
  28. }
  29.  
  30. bool remover_carro(int id_do_carro){
  31.  
  32.     return true;
  33. }
  34.  
  35. void listar_vagas(){
  36.  
  37.     for(int x=1; x<3; x++){
  38.  
  39.         cout << "ANDAR >>>> "<< x << " | ";
  40.  
  41.         for(int y=0; y<10; y++){
  42.  
  43.            estacionamento[x][y]=0;
  44.            cout<<" "<< estacionamento[x][y] << " ";
  45.  
  46.         }
  47.  
  48.         cout<<endl;
  49.  
  50.     }
  51. }
  52.  
  53. int menu(){
  54.     int opt;
  55.  
  56.     cout << "[1]- ***LISTAR ****" << endl;
  57.     cout << "[2]- **ESTACIONAR**" << endl;
  58.     cout << "[3]- ****REMOVER***" << endl;
  59.     cin>>opt;
  60.  
  61.     switch(opt){
  62.  
  63.         case 1:
  64.  
  65.             cout << endl;
  66.             cout << endl;
  67.             cout << endl;
  68.  
  69.             listar_vagas();
  70.  
  71.             cout << endl;
  72.             cout << endl;
  73.             cout << endl;
  74.  
  75.             menu();
  76.  
  77.         break;
  78.  
  79.         case 2:
  80.  
  81.             int TipoCarro;
  82.             int index=0;
  83.             int vagaOcupada=1;
  84.  
  85.  
  86.             cout<<"Informe o tipo do veículo? "<<endl;
  87.             cout<<"1 - CARRO"<<endl;
  88.             cout<<"2 - CAMINHÃO"<<endl;
  89.             cin>>TipoCarro;
  90.  
  91.             if(verifica_vaga_diponivel(1)){
  92.  
  93.  
  94.  
  95.             }
  96.             menu();
  97.  
  98.         break;
  99.  
  100.  
  101.  
  102.     }
  103.  
  104. }
  105.  
  106. bool verifica_vaga_diponivel(int andar){
  107.  
  108.     int vagaLivre=0;
  109.  
  110.     for(int y=0; y<10; y++){
  111.  
  112.         if(estacionamento[andar][y] == 0){
  113.            vagaLivre++;
  114.         }
  115.  
  116.     }
  117.  
  118.     if(vagaLivre>0)
  119.         return true;
  120.     else
  121.         return false;
  122.  
  123. }
Advertisement
Add Comment
Please, Sign In to add comment