[求助]大家帮我看看这个在c++环境下编的c程序的问题
#include<string.h>#define n 100
main()
{struct cxpf
{
char name[20];
int xh;
int pf;
}a[n]={{"张三",1,90},{"李四",2,89}};
struct cxpf *p,*q,a_1[n];
int i,j,b,c,k;char am[20];
for(p=a;p<a+n;p++)
{if(p->xh==0) return 0;
else printf("name:%s\nxh:%d\npf:%d\n",p->name,p->xh,p->pf);}
printf("要添加新学生操行平分情况请输入1,查找请输入2,修改请输入3,复制请输入4");
scanf("%d",&i);
if(i==1)//添加
{scanf("%s,%d,%d",&am,&b,&c);
strcpy(a[n+1].name,"am");a[n+1].xh=b;a[n+1].pf=c;
}
else if(i==2)
{
printf("请输入学号查找!");//查找
scanf("%d",&j);
for(q=a;q<a+n;q++)
if(q->xh==j) printf("name:%s\nxh:%d\npf:%d\n",q->name,q->xh,q->pf);
}
else if(i==3)
{
printf("请输入学号查找!");//修改
scanf("%d",&j);
for(k=0;k<n;k++)
if(a[k].xh==j)
scanf("%s,%d,%d",&am,&b,&c);
strcpy(a[k].name,"am"); a[k].xh=b; a[k].pf=c;
printf("name:%s\nxh:%d\npf:%d\n",a[k].name,a[k].xh,a[k].pf);
}
else if(i==4)//复制
{
strcpy(a_1[n].name,a[n].name);
a_1[n].xh=a[n].xh;
a_1[n].pf=a[n].pf;
}
else
printf("请按非1,2,3,4任意键退出");
}