viernes, 25 de febrero de 2011

CODIGO EN C++ TIENDA BORLAN (POO)

EL SIGUIENTE CODIGO EN C++  A SIDO COMPILADO EN BORLAN C++,PERO DE IGUAL MANERA PUEDE SERVIR EN DEV C++ O ALGUN OTRO,EN EL CASO DE DEVC++ SOLO ES CUESTIO DE QUE QUITEMOS LOS GOTOXY() Y LISTO...
EL CODIGO SIGUIETE PERMITE CALCULA EL COSTO EL SUBTOTAL Y TOTAL DE LAS COMPRAS DE UN CLIENTE ... APLICANDO UN DESCUENTO  A ALGUNAS DE SUS COMPRAS.... A COMTINUACION SE MUESTRA COMO APARECERA EN PANTALA...


EN ESTE CASO A ALGUNOS PRODUCTOS LES HEMOS APLICADO UN DESCUENTO
Y AL COSTO TOTAL CUANDO ESTE ES PAGADO AL CONTADO...

 #include <stdio.h>
  #include <conio.h>
  #define   P_BROCHAS 10
  #define   P_RODILLOS 15
  #define   P_SELLADORES 20
 class  Tienda
  {
   int num_brochas,num_rodillos,num_selladores;
   float brochas,rodillos,selladores,total_credito,total_contado;
    public:
  int cant_art()
    {
       printf("Ingrese la cantidad de brochas de serda\n\n  ");
       scanf("%i",&num_brochas);
       printf("Ingrese la cantidad de rodillos\n\n  ");
       scanf("%i",&num_rodillos);
       printf("Ingrese la cantidad de sellador\n\n  ");
       scanf("%i", &num_selladores);
   }
 int precio_subtotal()
 {
    brochas=num_brochas*P_BROCHAS-(num_brochas*P_BROCHAS*.20);
//COMENTARIO...SE LE DESCUENTA EL 20%
    rodillos=num_rodillos*P_RODILLOS-(num_rodillos*P_RODILLOS*.15);
//COMENTARIO...SE LE DESCUENTA EL 15%
    selladores=(num_selladores*P_SELLADORES);
 }
   int total()
   {
   printf(" total brochas       %.2f \n",brochas);
   printf(" total rodillos     %.2f \n",rodillos);
   printf("total selladores    %.2f \n\n\n",selladores);
   }
   int total_contado_credito()
     {
     printf("******************\n ");
     printf("total a contado\n    ");
     total_contado=brochas+rodillos+selladores-(brochas+rodillos+selladores*.07);
//COMENTARIO...SE LE DESCUENTA EL 7%
     printf("  %.2f \n\n \n",total_contado);
     printf("total a credito\n   ");
     total_credito=brochas+rodillos+selladores;
     printf("  %.2f\n\n\n",total_credito);
     printf("GRACIAS POR SU COMPRA\a");
     }

 };

int main()
   {
   printf("                   Ferreteria ACME\n\n\n");
   printf("*********************\n ");
   printf("Nuestros precios\n");
   printf("Brochas de serda $10.00\n");
   printf("Rodillos $15.00\n");
   printf("Sellador $20.00 \n");
   printf("******************\n\n\n ");
   Tienda ventas;
   ventas.cant_art();
   ventas.precio_subtotal();
   ventas.total();
   ventas.total_contado_credito();
   getch();

 }



ESPERO LES SEA UTIL..

No hay comentarios:

Publicar un comentario