帮忙看下!!谢谢了,那里出错啦??
#define N 100#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student
{char name[20];
char reason[20];
float money;
}st[N];
typedef struct student STUDENT;
main()
{FILE *fp1,*fp2;
char ch;
int i;
float f;
if((fp1=fopen("file1.txt","w"))==NULL)
{printf("\n文件file1.txt打不开!\n");
exit(0);}
i=0;
do
{printf("请输入班费信息:姓名,原因,金额");
scanf("%s%s%f",st[i].name,st[i].reason,&f);
st[i].money=f;
fwrite(&st[i],sizeof(struct student),2,fp1);
i++;
getchar();
printf("\n继续输入学生信息(y/n)?");
ch=getchar();getchar();}
while(ch=='y'||ch=='Y');
fclose(fp1);
if((fp2=fopen("file1.txt","r"))==NULL)
{printf("\n文件file1.txt打不开!\n");
exit(0);}
while(fread(&st,sizeof(struct student),1,fp2)==1)
{printf("\n姓名:%s",st->name);
printf("\n原因:%s",st->reason);
printf("\n金额:%f",st->money);}
if(!feof(fp2)) printf("\n读文件出错! \n");
fclose(fp2);}
void sortrecord(void);
{char str[N];
int i,j;
STUDENT tmps;
if(N=0)
printf("没有可供排序的记录!\n");
printf("请输入排序的方式:\n");
printf("1按姓名升序进行排序。\n");
if(str[0]<'1'||str[0]>'6') return;
for(i=0;i<N-1;i++)
for(j=i+1;j<N;j++)
if(str[0]=='1'&&strcmp(st[i].name,st[j].name>0))
{copyst(&st[i],&tmps);
copyst(&st[j],&st[i]);
copyst(&tmps,&st[j]);}
printf("排序已完成!");
savedtag=1;}}