Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.40 KB | None | 0 0
  1.  
  2. using namespace std;
  3.  
  4. void main()
  5. {
  6.     int codigo, tiempo, tipopizza, cantgratis, contgrande;
  7.     int contfam, contsuperfam,mayor, contmost, contdel;
  8.     char tipopedido;
  9.     float importetotal, importe, tiempodel, tiempomost;
  10.     cantgratis = contgrande = contsuperfam = contfam = 0;
  11.     contdel = contmost = 0;
  12.     importetotal = tiempodel = tiempomost = 0;
  13.     do
  14.     {
  15.         do
  16.         {
  17.             cout << "ingrese el codigo(4digitos) o 0 para fin: ";
  18.             cin >> codigo;
  19.         } while ((codigo < 1000 || codigo>9999) && (codigo != 0));
  20.         do
  21.         {
  22.             cout << "ingrese tipo de pizza(1,2,3): ";
  23.             cin >> tipopizza;
  24.         } while (tipopizza < 1 || tipopizza>3);
  25.         do
  26.         {
  27.             cout << "ingrese tipo de pedido(D o M): ";
  28.             cin >> tipopedido;
  29.             tipopedido = toupper(tipopedido);
  30.         } while (tipopedido != 'D'&& tipopedido != 'M');
  31.         do
  32.         {
  33.             cout << "ingrese tiempo de etrega: ";
  34.             cin >> tiempo;
  35.         } while (tiempo < 1);
  36.         if (tipopizza == 1)
  37.         {
  38.             importe = 50;
  39.             contgrande++;
  40.         }
  41.         else
  42.             if (tipopizza ==
  43.                
  44.                
  45.                
  46.                 2)
  47.             {
  48.                 importe = 60;
  49.                 contfam++;
  50.             }
  51.             else
  52.             {
  53.                 importe = 68;
  54.                 contsuperfam++;
  55.             }
  56.         if (tipopedido == 'D')
  57.         {
  58.             if (tiempo > 30)
  59.             {
  60.                 cantgratis++;
  61.                 cout << "importe a pagar : Gratis/n ";
  62.             }
  63.             else
  64.             {
  65.                 contdel++;
  66.                 tiempodel += tiempo;
  67.                 importetotal += importe;
  68.                 cout << "importe a pagar: " << importe << endl;
  69.             }
  70.         }
  71.         else
  72.         {
  73.             if (tiempo > 20)
  74.             {
  75.                 cantgratis++;
  76.                 cout << "importe a pagar : Gratis\n ";
  77.             }
  78.             else
  79.             {
  80.                 contmost++;
  81.                 tiempomost += tiempo;
  82.                 importetotal += importe;
  83.                 cout << "importe a pagar: " << importe << endl;
  84.             }
  85.         }
  86.         } while (codigo!=0);
  87.         cout << "importe total el ultimo mes " << importetotal << endl;
  88.         cout << "cantidad de pedidos entregados gratis: " << cantgratis << endl;
  89.         mayor = contgrande;
  90.         if (contfam > mayor)mayor = contfam;
  91.         if (contsuperfam > mayor)mayor = contsuperfam;
  92.         cout << "la pizza con mayor demanda es :\n ";
  93.         if (mayor == contgrande)cout << "Grande\n";
  94.         if (mayor == contfam)cout << "Familiar\n";
  95.         if (mayor == contsuperfam)cout << "Super Familiar\n";
  96.         cout << "tiempo de entrega promedio por cada tipo:\n";
  97.         if (contdel > 0)
  98.             cout << "Delivery: " << tiempodel / contdel << endl;
  99.         else
  100.             cout << "Delivery: 0\n";
  101.         if (contmost > 0)
  102.             cout << "Mostrador: " << tiempomost / contmost << endl;
  103.         else
  104.             cout << "Mostrador: 0";
  105.         _getch();
  106.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement