这个程序的错误不知道怎么改
#include"stdio.h"struct xinxi
{char name[20];
char yuanxi[20];
long num;
int xiangmu;
int mingci;
};
struct xinxi a[50];
struct xinxi p;
shuru()
{int i;
char c;
for(i=0;i<50;i++)
{printf("qing shu ru bi sai xiang mu bian hao\n");
scanf("%d",&a[i].xiangmu);
printf("\n name:\n");
scanf("%s",a[i].name);
printf("\n yuanxi \n");
scanf("%s",a[i].yuanxi);
printf("\n xuehao \n");
scanf("%ld",&a[i].num);
printf("\n ming ci \n");
scanf("%d",&a[i].mingci);
printf("\n continue yes or no? xie y|n\n");
scanf("%c",&c);
if(c=='y') continue;
if(c=='n') break;}
return;}
chazhao()
{int i,j;
long b;
printf("qing shu ru chao zhao de xue hao(0=tiaochu)\n");
scanf("ld",&b);
printf("\n xiang mu \n");
scanf("%d",&j);
while(b!=0)
{
for(i=0;i<50;i++)
{if(a[i].num==b&&a[i].xiangmu==j)
printf("xing ming :%s\n",a[i].name);
printf("yuan xi :%s\n",a[i].yuanxi);
printf("xiang mu :%d\n",a[i].xiangmu);
printf("xue hao: %ld\n",a[i].num);
printf("ming ci :%d\n",a[i].mingci);}
printf("\n qing shu ru chao zhao de xue hao(0=tiaochu)\n");
scanf("ld",&b);
printf("\n xiang mu \n");
scanf("%d",&j);}
return;}
xianshi(int n)
{int i,j,k;
FILE *fw;
fw=fopen("D:\hujian.txt","w");
for(k=1;k<=n;k++)
{printf("di %d xiang bi sai de ji lu\n",k);
fprintf(fw,"di %d xiang bi sai de ji lu\n",k);
for(i=1;i<50;i++)
for(j=0;j<50-i;j++)
{if(a[j].mingci<a[j+1].mingci) {p=a[j];a[j]=a[j+1];a[j+1]=p;}}
for(i=0;i<3;i++)
printf("%10s %10s %10ld %10d\n",a[i].name,a[i].yuanxi,a[i].num,a[i].mingci);
fprintf(fw,"%10s %10s %10ld %10d\n",a[i].name,a[i].yuanxi,a[i].num,a[i].mingci);
}
return;}
shanchu(int n)
{long b;
int a,h,j,i,k;
FILE *fw;
fw=fopen("D:\hujian.txt","w");
printf("qing shu ru xue hao\n");
scanf("%ld",&b);
printf("\n xiang mu \n");
scanf("%d",&a);
for(h=0;h<50;h++)
{if(a[h].num==b&&a[h].xiangmu==a)
{
for(k=1;k<=n;k++)
{printf("di %d xiang bi sai de ji lu\n",k);
fprintf(fw,"di %d xiang bi sai de ji lu\n",k);
for(i=1;i<50;i++)
for(j=0;j<50-i;j++)
{if(a[j].mingci<a[j+1].mingci) {p=a[j];a[j]=a[j+1];a[j+1]=p;}}
for(i=h;i<50;i++)
a[i+1]=a[i];
for(i=0;i<3;i++)
{printf("%10s %10s %10ld %10d\n",a[i].name,a[i].yuanxi,a[i].num,a[i].mingci);
fprintf(fw,"%10s %10s %10ld %10d\n",a[i].name,a[i].yuanxi,a[i].num,a[i].mingci);}}
return;}
main()
{int n,g;
printf("*********** ****************** 1.shuru **************************************\n");
printf("*********** ****************** 2.chazhao **************************************\n");
printf("*********** ****************** 3.xianshi **************************************\n");
printf("*********** ****************** 4.shanchu **************************************");
printf("\n qing xian shu ru bi sai xiang mu ge shu\n");
sanf("%d",&n);
printf("\nqing shu ru ni de xun ze(1-4)\n");
scanf("%d",&g);
switch(g)
{ case 1:shuru(n);break;
case 2:chazhao();break;
case 3:xianshi(n);break;
case 4:shanchu(n);break;
defult:printf("wrong\n");
}}