/*-------------------------------------------------------【程序设计】---------------------------------------------------------题目:学生的记录由学号和成绩组成,N名学生的数据已放入主函数中的结构体数组s中。 请编写函数fun,其功能是:把指定分数范围内的学生数据放在b所指的数组中,分 数范围内的学生人数由函数值返回。例如:输入的分数是60、69,则应当把分数在60~69的学生数据输出,包含60分和69分的学 生数据。主函数中把60放在low中,把69放在heigh中。注意:请勿改动主函数main和其它函数中的任何内容,仅在函数fun的花括号中填入 你编写的若干语句。-------------------------------------------------------*/#include <stdio.h>#define N 16void wwjt();typedef struct{ char num[10]; int s;} STREC;int fun( STREC *a,STREC *b,int l, int h ){ /**********Program**********/ int i,j=0; for(i=0;i<N;i++) if(a[i].s>=1&&a[i].s<=h) b[j++]=a[i]; return j; /********** End **********/}main(){ STREC s[N]={{"GA005",85},{"GA003",76},{"GA002",69},{"GA004",85}, {"GA001",96},{"GA007",72},{"GA008",64},{"GA006",87}, {"GA015",85},{"GA013",94},{"GA012",64},{"GA014",91}, {"GA011",90},{"GA017",64},{"GA018",64},{"GA016",72}}; STREC h[N]; int i,n,low,heigh,t; printf("Enter 2 integer number low & heigh : "); scanf("%d%d", &low,&heigh); if ( heigh< low ) { t=heigh; heigh=low; low=t; } n=fun( s,h,low,heigh ); printf("The student's data between %d--%d :\n",low,heigh); for(i=0;i<n; i++) printf("%s %4d\n",h[i].num,h[i].s); printf("\n"); wwjt();}void wwjt(){ FILE *in, *out ; STREC s[N],h[N]; int i,j,n; in=fopen("in.dat","r"); if(in==NULL) { printf("Please Verify The Currernt Dir..It May Be Changed"); } out=fopen("out.dat","w"); if(out==NULL) { printf("Please Verify The Current Dir.. It May Be Changed"); } for(j=0;j<10;j++) { for(i=0;i<16;i++) { fscanf(in,"%s %d",&s[i].num,&s[i].s); } n=fun( s,h,80,98 ); fprintf(out,"%d\n",n); } fclose(in); fclose(out);}