Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int LeeControlDatoI(int,int);
- float LeeControlDatoF(float,float);
- void CargarPizza(int[],float[],int);
- int BusquedaPizza(int[],int,int);
- void MostrarRecaudacion(int[],float[][6],int,int);
- void MostrarMoto(int[],int);
- int Maximo(int[],int);
- void InformeMaximo(int[],int,int);
- void InformeNoPedido(int[],float[][6],int,int);
- main()
- {
- int cod[45],cantviaj[6]={0};
- int ticket,pizza,pos,moto,max,cant;
- float pre[45],recau[45][6]={{0}};
- float impo;
- CargarPizza(cod,pre,45);
- printf("\n Ingrese numero de ticket: ");
- scanf("%d", &ticket);
- while(ticket!=0)
- {
- printf("\n Ingrese codigo de pizza: ");
- scanf("%d",&pizza);
- pos=BusquedaPizza(cod,pizza,45);
- if(pos>=0)
- {
- moto=LeeControlDatoI(1,6);
- printf("\n Ingrese la cantidad pedida");
- scanf("%d",&cant);
- impo=pre[pos]*cant;
- if(cant>3)
- impo=impo*0,9;
- recau[pos][moto-1]+=impo;
- cantviaj[moto-1]++;
- }
- else
- {
- printf("\n Error Pizza");
- }
- printf("\n Ingrese otro numero de ticket: ");
- scanf("%d", &ticket);
- }
- MostrarRecaudacion(cod,recau,45,6);
- MostrarMoto(cantviaj,6);
- max=Maximo(cantviaj,6);
- InformeMaximo(cantviaj,max,6);
- InformeNoPedido(cod,recau,45,6);
- }
- //////////////////////////////////////////////////////////
- int LeeControlDatoI(int Li, int Ls)
- { int dato;
- do
- {
- printf ("\n Ingrese dato: ");
- scanf("%d",&dato);
- }while((dato<Li)||(dato>Ls));
- return(dato);
- }
- /////////////////////////////////////////////////////////
- float LeeControlDatoF(float Li, float Ls)
- { float dato;
- do
- {
- printf ("\n Ingrese dato: ");
- scanf("%f",&dato);
- }while((dato<Li)||(dato>Ls));
- return(dato);
- }
- ////////////////////////////////////////////////////////
- void CargarPizza (int Pi[],float Pr[],int n)
- {
- int i;
- for(i=0;i=n-1;i++)
- printf("\n Ingrese codigo de la pizza: ");
- Pi[i]=LeeControlDatoI(100,999);
- printf("\n Ingrese el precio de la pizza: ");
- Pr[i]=LeeControlDatoF(1,1000);
- }
- ///////////////////////////////////////////////////////
- int BusquedaPizza(int V[], int x, int n)
- {
- int i=0;
- int p=-1;
- while((p==-1)&&(i<n))
- if(V[i]==x)
- {
- p=i;
- }
- else
- {
- i++;
- }
- return(p);
- }
- /////////////////////////////////////////////////////
- void MostrarRecaudacion(int P[],float R[][6],int f,int c)
- {
- int i,j,dia,mes;
- printf("\n Ingrese dia: ");
- dia=LeeControlDatoI(1,31);
- printf("\n Ingrese mes: ");
- mes=LeeControlDatoI(1,12);
- printf("\n Recaudacion de pizza segun moto de reparto");
- printf("\n del: ", dia, "/", mes);
- printf("\n Codigo de Pizza Moto1 Moto2 ... Moto6");
- for(i=0;i=f-1;i++)
- {
- printf("\n", P[i]);
- for(j=0;j=c-1;j++)
- printf("\t", R[i][j]);
- }
- }
- /////////////////////////////////////////////////////
- void MostrarMoto(int V[],int n)
- {
- int i;
- printf("\n Mostrar viaje por moto");
- printf("\n Numero de moto Cant");
- for(i=0;i=n-1;i++)
- printf("\n", i+1, "\t", V[i]);
- }
- ///////////////////////////////////////////////////
- int Maximo(int V[],int n)
- {
- int i,max;
- max=V[0];
- for(i=1;i=n-1;i++)
- if(V[i]>max)
- max=V[i];
- return(max);
- }
- ///////////////////////////////////////////////////
- void InformeMaximo(int V[], int maxi, int n)
- {
- int i;
- printf("\n Maximo de viajes: ", maxi);
- for(i=0;i=n-1;i++)
- if(V[i]==maxi)
- printf("\n Moto: ", i+1);
- }
- ///////////////////////////////////////////////////
- void InformeNoPedido(int V[],float M[][6], int f, int c)
- {
- int i,j,s;
- printf("\n Pizzas que no se pidieron: ");
- for(i=0;i=f-1;i++)
- {
- s=0;
- for(j=0;j=c-1;j++)
- {
- s+=M[i][j];
- }
- if(s==0)
- {
- printf("\n V[i]");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement