#include <stdio.h>
#define N 16
typedef struct
{ char num[10];
int s;
} STREC;
int fun( STREC *a, STREC *b )
{
int i;
int j = 0;
int k = 0;
for (i = 0 ;i < 16;i++)
{if(a[i].s < a[i+1].s)//a->s[]是不行的。。
{
j = a[i].s;
}
if(a[i].s >= a[i+1].s)
{
j = a[i+1].s;
};}
printf("%d\n",j);
for (i = 0 ;i < 16;i++)
{
if (a[i].s == j)
{
b[k] = a[i];
k = k+1;
}
}
return k;
}
main()
{ STREC s[N]={{"GA05",85},{"GA03",76},{"GA02",69},{"GA04",85},
{"GA01",91},{"GA07",72},{"GA08",64},{"GA06",87},
{"GA015",85},{"GA013",91},{"GA012",64},{"GA014",91},
{"GA011",91},{"GA017",64},{"GA018",64},{"GA016",72}};
STREC h[N];
int i,n;FILE *out ;
n=fun( s,h );
printf("The %d lowest score :\n",n);
for(i=0;i<n; i++)
printf("%s %4d\n",h[i].num,h[i].s);
printf("\n");
out = fopen("out.dat","w") ;
fprintf(out, "%d\n",n);
for(i=0;i<n; i++)
fprintf(out, "%4d\n",h[i].s);
fclose(out);
}