# include <stdio.h>
# include <string.h>
# define sub 20
struct equis
{
char nombre[15];
char presidente[20];
int puntos;
};
void carga (struct equis [],int *);
void ordena (struct equis [],int);
char* mayor (struct equis [],int);
void menores (struct equis [],int,int);
main ()
{
struct equis equipos[sub];
int i,cant_e,pts;
char opcion,*equipo[15];
cant_e=0;
do
{
printf ("b) lista Ordenada por puntosn"); printf ("c) Equipo con mas puntosn"); printf ("d) equipos con menos puntos que el ingresado"); do
{
}while((opcion !='a') && (opcion !='b') && (opcion !='c') && (opcion !='d') && (opcion !='e'));
switch (opcion)
{
case 'a':
{
carga(equipos,&cant_e);
}break;
case 'b':
{
ordena(equipos,cant_e);
}break;
case 'c':
{
*equipo= mayor (equipos,cant_e);
printf ("El equipo de mayor puntaje es %s",*equipo
); }break;
case 'd':
{
menores (equipos,pts,cant_e);
}
}
}while(opcion !='e');
}
void carga (struct equis e[],int *cant)
{
int i,j;
char resp;
i=*cant;
do
{
printf ("Ingrese Nombre Equipon");
scanf ("%s",e
[i
].
nombre); printf ("Ingrese Nombre Presidenten"); scanf ("%d",&e
[i
].
puntos); ++i;
}while (resp !='n');
*cant=i;
for (j=0;j<*cant;++j)
{
printf ("%s %d",e
[j
].
nombre,e
[j
].
puntos);
}
}
void ordena (struct equis e[],int cant)
{
int i,j,k,aux;
char caux[15];
aux=0;
for (i=0;i<cant;i++)
{
for (j=1;j<cant;j++)
{
if ( e[i].puntos < e[j].puntos)
{
aux=e[i].puntos;
e[i].puntos=e[j].puntos;
e[j].puntos=aux;
strcpy(e
[j
].
nombre,e
[i
].
nombre); }
}
}
for (k=0;k<cant;++k)
{
}
}
char* mayor (struct equis e[],int cant)
{
int i,mayor,indice;
mayor=0;
indice=0;
for (i=0;i<cant;++i)
if (e[i].puntos > mayor)
{
mayor=e[i].puntos;
indice=i;
}
return (e[indice].nombre);
}
void menores (struct equis e[],int num,int cant)
{
int i,j;
j=0;
char caux[cant][15];
for (i=0;i<cant;++i)
{
if (e[i].puntos < num)
{
++j;
}
}
for (i=0;i<cant;++i)
}