Código:
#include <stdio.h>
#include <conio.h>
int imporencomienda(int,int,int,int);
void importe ();
void main()
{int p,camion=0,a,b,z,c,impt=0,carga,impc;
float prome1;
a=importe(); ////not an allowed type
b=importe(); ////not an allowed type
c=importe(); ////not an allowed type
do
{
printf("Ingresar Peso");
scanf("%d",&p);
}
while(p<=0&&p>=200);
printf("\t\tDespacho de Encomiendas");
while(p>0)
{
camion++;
carga=0;
impc=0;
while(carga+=p<=2000&&p>0)
{
carga+=p;
impc=imporencomienda(p,a,b,c);
do
{
printf("Ingresar Peso");
scanf("%d",&p);
}
while(p<=0&&p>=200);
}
printf("Camion %d Carga %d Importe por Camion %d",camion,carga,impc);
if(carga>1800)
{
impt+=impc;
c++;
}
else ;
}
prome1=impt/c;
printf("Prome 90% %f",prome1);
getch();
}
int imporencomienda(int a,int b, int c, int d)
{
if(a>0&&a<=10)
return(b);
else
if(a>10&&a>=40)
return(c);
else
return(d);
}
void importe(x)
{
scanf("%d",&x);
return(x); ////importe() cannot return a value
}
#include <conio.h>
int imporencomienda(int,int,int,int);
void importe ();
void main()
{int p,camion=0,a,b,z,c,impt=0,carga,impc;
float prome1;
a=importe(); ////not an allowed type
b=importe(); ////not an allowed type
c=importe(); ////not an allowed type
do
{
printf("Ingresar Peso");
scanf("%d",&p);
}
while(p<=0&&p>=200);
printf("\t\tDespacho de Encomiendas");
while(p>0)
{
camion++;
carga=0;
impc=0;
while(carga+=p<=2000&&p>0)
{
carga+=p;
impc=imporencomienda(p,a,b,c);
do
{
printf("Ingresar Peso");
scanf("%d",&p);
}
while(p<=0&&p>=200);
}
printf("Camion %d Carga %d Importe por Camion %d",camion,carga,impc);
if(carga>1800)
{
impt+=impc;
c++;
}
else ;
}
prome1=impt/c;
printf("Prome 90% %f",prome1);
getch();
}
int imporencomienda(int a,int b, int c, int d)
{
if(a>0&&a<=10)
return(b);
else
if(a>10&&a>=40)
return(c);
else
return(d);
}
void importe(x)
{
scanf("%d",&x);
return(x); ////importe() cannot return a value
}
gracias