void CX()
{
system("cls");
FILE *fp;
fp=fopen("student.dat","rb");
STU stu_tmp;
int num1,flag1=1,choice,ma;
char jx1;
char name1[15];
while(flag1)
{
system("cls");
cout<<"按学号查询请输入1,按姓名查询请输入2"<<endl;
cin>>choice;
if(choice==1)
{
cout<<"请输入要查询的学生学号"<<endl;
cin>>num1;
while(fread(&stu_tmp,sizeof(STU),1,fp)==1)
{
if(num1==stu_tmp.num)
cout<<stu_tmp.num<<" "<<stu_tmp.name<<" "<<stu_tmp.sex<<" "<<stu_tmp.english<<" "<<stu_tmp.cyuyan;
}
}
if(choice==2)
{
flag1=1;
cout<<"请输入要查询的学生姓名"<<endl;
cin>>name1[15];
while(fread(&stu_tmp,sizeof(STU),1,fp)==1)
{
if( strcmp(name1,stu_tmp.name)==0)
cout<<stu_tmp.num<<" "<<stu_tmp.name<<" "<<stu_tmp.sex<<" "<<stu_tmp.english<<" "<<stu_tmp.cyuyan;
}
}
fseek(fp,0,0);
cout<<"是否继续查询学生信息:(Y/N)?"<<endl;
cin>>jx1;
if(jx1=='y'||jx1=='Y')
flag1=1;
else
flag1=0;
}
fclose(fp);
}
{
system("cls");
FILE *fp;
fp=fopen("student.dat","rb");
STU stu_tmp;
int num1,flag1=1,choice,ma;
char jx1;
char name1[15];
while(flag1)
{
system("cls");
cout<<"按学号查询请输入1,按姓名查询请输入2"<<endl;
cin>>choice;
if(choice==1)
{
cout<<"请输入要查询的学生学号"<<endl;
cin>>num1;
while(fread(&stu_tmp,sizeof(STU),1,fp)==1)
{
if(num1==stu_tmp.num)
cout<<stu_tmp.num<<" "<<stu_tmp.name<<" "<<stu_tmp.sex<<" "<<stu_tmp.english<<" "<<stu_tmp.cyuyan;
}
}
if(choice==2)
{
flag1=1;
cout<<"请输入要查询的学生姓名"<<endl;
cin>>name1[15];
while(fread(&stu_tmp,sizeof(STU),1,fp)==1)
{
if( strcmp(name1,stu_tmp.name)==0)
cout<<stu_tmp.num<<" "<<stu_tmp.name<<" "<<stu_tmp.sex<<" "<<stu_tmp.english<<" "<<stu_tmp.cyuyan;
}
}
fseek(fp,0,0);
cout<<"是否继续查询学生信息:(Y/N)?"<<endl;
cin>>jx1;
if(jx1=='y'||jx1=='Y')
flag1=1;
else
flag1=0;
}
fclose(fp);
}

