Miketo_prog

PlatosRotos1

Mar 9th, 2021 (edited)
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     float precios[4][4];
  7.     bool vajilla[4][4] = {0};
  8.     int platos;
  9.     float costo = 0;
  10.     float descontar = 0;
  11.  
  12.     for(int i=0; i<4; i++)
  13.         for(int j=0; j<4; j++)
  14.             cin >> precios[i][j];
  15.  
  16.     cin >> platos;
  17.  
  18.     for(int k=0; k<platos; k++){
  19.         string cad;
  20.  
  21.         cin >> cad;
  22.  
  23.         int i = cad[0] - 'A';
  24.         int j = cad[1] - '0' - 1;
  25.  
  26.         vajilla[i][j] = true;
  27.  
  28.         costo += precios[i][j];
  29.     }
  30.  
  31.     for(int i=0; i<4; i++){
  32.         bool des = true;
  33.  
  34.         for(int j=0; j<4; j++)
  35.             if( vajilla[i][j]==0 )
  36.                 des = false;
  37.         if( des )
  38.             descontar += 10;
  39.     }
  40.  
  41.     cout << costo-descontar;
  42.  
  43.     return 0;
  44. }
Add Comment
Please, Sign In to add comment