Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: C++  |  size: 1.57 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int main()
  5. {
  6.         int codigo,tipo_pizza,tiempo,valor_ind,valor_tot=0,gratis_del=0,gratis_mos=0,gratis=0;
  7.         char tipo_pedido;
  8.  
  9.         do
  10.         {
  11.                
  12.                         printf("\nIngrese el codigo: ");
  13.                         scanf("%d",&codigo);
  14.                         if(codigo<9999 && codigo>999)
  15.                         {              
  16.                         printf("Ingrese el tipo de pizza(1-GRANDE 2-FAMILIAR 3-SUPER): ");
  17.                         scanf("%d",&tipo_pizza);flushall();
  18.                         printf("Ingrese el tipo de pedido(D-DELIVERY M-MOSTRADOR): ");
  19.                         scanf("%c",&tipo_pedido);
  20.                         printf("Ingrese el tiempo de entrega: ");
  21.                         scanf("%d",&tiempo);
  22.                         gratis_del= gratis_del + (tiempo>30 && tipo_pedido=='D');
  23.                         gratis_mos= gratis_mos + (tiempo>25 && tipo_pedido=='M');
  24.                                 switch(tipo_pedido)
  25.                                 {
  26.                                         case 'D':
  27.                                                 {
  28.                                                         if(tiempo>30)
  29.                                                         {
  30.                                                                 printf("GRATIS");
  31.                                                         }
  32.                                                         else
  33.                                                         {
  34.                                                                 valor_ind=(tipo_pizza==1)*50+(tipo_pizza==2)*60+(tipo_pizza==3)*68;
  35.                                                                 valor_tot=valor_tot+valor_ind;
  36.                                                         }
  37.                                                 }break;
  38.                                         case 'M':
  39.                                                 {
  40.                                                         if(tiempo>25)
  41.                                                         {
  42.                                                                 printf("GRATIS\n");
  43.                                                         }
  44.                                                         else
  45.                                                         {
  46.                                                                 valor_ind=(tipo_pizza==1)*50+(tipo_pizza==2)*60+(tipo_pizza==3)*68;
  47.                                                                 valor_tot=valor_tot+valor_ind;
  48.                                                         }
  49.                                                 }break;
  50.                                 }
  51.                         }
  52.                
  53.         }while(codigo!=0);
  54.         gratis=gratis_del+gratis_mos;
  55.  
  56.         printf("\nImporte total del ultimo mes: %d\n",valor_tot);
  57.         printf("Cantidad de pedidos entregados gratis: %d\n",gratis);
  58.         // printf("La pizza con mayor demanda: %d\n",tipo_pizza);
  59.         // printf("Tiempo de entrega promedio de la mayor demanda en D y M: %d\n",tiempo);
  60.  
  61.  
  62. _getch();
  63. return 0;
  64. }