Advertisement
Miketo_prog

PlatosRotos2

Mar 9th, 2021
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     float precios[4][4];
  7.     int vajillas[4]={0};
  8.     int platos;
  9.     float costo = 0.0;
  10.     float descontar=0.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.         vajillas[i] += j+1;
  27.  
  28.         costo += precios[i][j];
  29.     }
  30.  
  31.     for(int i=0; i<4; i++)
  32.         descontar += (vajillas[i]/10)*10;
  33.  
  34.     cout << costo-descontar;
  35.  
  36.     return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement