Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
- int valida (int,int);
- void carga (int[],char[][51],float[]);
- int buscar (int[],int,int);
- void año(float[][12],int,int,int[],char[][51]);
- void mes(float[][12],int,int);
- void maximo(float[][12],int);
- void ordenar(int[],int,int[],char[][51]);
- int main()
- {
- int tot,cod[1000],cant[1000],pos,canti,codi,mes;
- char desc[1000][51];
- float precio[1000],mat[1000][12],tach[12];
- tot=carga(cod,desc,precio);
- printf("Ingrese el codigo de producto");
- codi=valida(99,999);
- while(codi!=99)
- {
- pos=buscar(cod,codi,tot);
- if(pos!=-1)
- {
- puts("Ingrese mes de facturazion");
- mes=validar(1,12);
- puts("Ingrese cantidad vendida");
- canti=valida(5,100);
- mat[pos][mes-1]+=canti*precio[pos];
- if(strcmpi(desc[pos],"tachuelas")==0)
- {
- tach[mes-1]+=canti*precio[pos];
- }
- cant[pos]+=canti;
- }else puts("Nose ha encontrado codigo");
- printf("Ingrese el codigo de producto");
- codi=valida(99,999);
- }
- año(mat,tot,12,cod,desc);
- mes(mat,tot,12);
- max=maximo(mat,7);
- ordenar(cant,tot,cod,desc);
- }
- ////////////////////////////////////////////////////////////////
- int valida(int li,int ls)
- {
- int a;
- do
- {
- scanf("%d",&a);
- }while(a<li||a>ls);
- return a;
- }
- /////////////////////////////////////////////////////////////////////////
- int carga(int cod[],char desc[][51],float prec[],int t;)
- {
- int a,i=0;
- float b;
- printf("Ingrese descripcion del produco");
- fflush(stdin);
- gets(desc[i]);
- desc=toupper(desc);
- while(strcmpi(desc[i],"fin")!=0)
- {
- puts("Ingrese Codigo de producto");
- a=valida(100,999);
- do
- {
- puts("Ingrese el precio del producto");
- scanf("%f",&b)
- }while(b<500||b>10000);
- cod[i]=a;
- prec[i]=b;
- i++;
- puts("Ingrese descripcion del produco");
- fflush(stdin);
- gets(desc[i]);
- desc=toupper(desc);
- }
- return i;
- }
- ////////////////////////////////////////////////
- void mes(float mat[][51],int tot,int a)
- {
- int i,j;
- float acum=0;
- printf("\nMes\tImporte Total")
- for(j=0;j<a;j++)
- {
- acum=0;
- for(i=0;i<tot;i++)
- {
- acum+=mat[i][j];
- }
- printf("\n%d\t%f",j+1,acum);
- }
- }
- /////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement