Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int actualizarStock( int vlamp[],int num,int lamp,int vstock[],int cant_ped); // declaracion e la funcion
  7.  
  8. int main(int argc, char *argv[]) {
  9. int nro_lamp,stock_actual,nro_emp,i,j,vlamp[3],vstock[3],vemp[2],nro_pedido,emp,cant_ped,lamp,r;
  10. float precio,com_ven,vprecio[3],vcom_ven[2];
  11.  
  12. for (i=0;i<3;i++){
  13. printf("Ingrese numero de lampara: ");
  14. scanf("%d",&nro_lamp);
  15. printf("Ingrese precio: ");
  16. scanf("%f",&precio);
  17. printf("Ingrese stock actual: "); //lote de datos cargado
  18. scanf("%d",&stock_actual);
  19.  
  20. vlamp[i]=nro_lamp;
  21. vprecio[i]=precio;
  22. vstock[i]=stock_actual;
  23. }
  24.  
  25. for (j=0;j<2;j++){
  26. printf("Ingrese numero de empleado: ");
  27. scanf("%d",&nro_emp);
  28. printf("Ingrese comision sobre las ventas: ");
  29. scanf("%f",&com_ven);
  30.  
  31. vemp[j]=nro_emp;
  32. vcom_ven[j]=com_ven; //lote de dato 2 cargado
  33. }
  34.  
  35. printf("Ingrese numero de pedido: ");
  36. scanf("%d",&nro_pedido);
  37.  
  38. while(nro_pedido!=0){
  39. printf("Ingrese numero de lampara: ");
  40. scanf("%d",&lamp);
  41. printf("Ingrese cantidad pedida: ");
  42. scanf("%d",&cant_ped);
  43. printf("Ingrese empleado que atendio: "); //Ingreso estos valores
  44. scanf("%d",&emp);
  45.  
  46. r= actualizarStock(vlamp,3,lamp,vstock,cant_ped);
  47.  
  48.  
  49. printf("Ingrese numero de pedido: ");
  50. scanf("%d",&nro_pedido);
  51. }
  52.  
  53.  
  54.  
  55. int actualizarStock( int vlamp[],int num,int lamp,int vstock[],int cant_ped){ //definicion de la funcion
  56. int k;
  57. for(i=0;i<num;i++){ //codigo para actualizar el stock
  58. if(vlamp[i]==lamp){
  59. k=i;
  60. }
  61. if(vstock[i]>cant_ped){
  62. vstock[i]=vstock[i]-cant_ped;
  63. }
  64. }
  65.  
  66. return vstock[i];
  67. }
  68.  
  69.  
  70. return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement