void Found() /*查询模块*/ { system("color CF"); int j=0; long int xuehao; /*学号*/ char name[10]; /*姓名*/ char sex[4]; /*性别*/ int age; /*年龄*/ char birth[10]; /*出生年月*/ char address[10]; /*地址*/ struct stu *p; int x; int lgl=1; while(lgl==1) { int xs=0; //控制查询到的信息显示// system("cls"); /*清屏*/ printf("\n\n\n"); printf(" |=============================|\n"); printf(" |=============================|\n"); printf(" | 请选择要查询的项目: |\n"); printf(" |=============================|\n"); printf(" | 1.学号 2.姓名 |\n"); printf(" |=============================|\n"); printf(" | 3.性别 4.年龄 |\n"); printf(" |=============================|\n"); printf(" | 5.出生日期 6.地址 |\n"); printf(" |=============================|\n"); printf(" | 7.取消 |\n"); printf(" |=============================|\n"); printf(" |=============================|\n"); printf("请选择想要查询的项目1-7:"); scanf("%d",&x); switch(x) { case 1: printf("请输入查询学号:"); scanf("%ld",&xuehao); for(p=s;pxuehao==xuehao) {j=1; if(xs==0) {printf("查询到的信息如下:\n"); xs++; printf(" 学号 姓名 性别 年龄 出生年月 地址 电话号码 mail\n");} printf("% -10ld% -9s% -5s% -6d% -11s% -11s% -15s% -20s\n",p->xuehao,p->name,p->sex,p->age,p->birth,p->address,p->phone,p->mail); } } if(j==0) { printf("\n\n查无此人!\n是否继续查询:(Y/N)"); char a; scanf("%s",&a); if(a=='y'||a=='Y') lgl=1; if(a=='n'||a=='N') lgl=0; } if(j==1) { j=0; printf("是否继续查询:(Y/N)"); char b; scanf("%s",&b); if(b=='y'||b=='Y') lgl=1; if(b=='n'||b=='N') lgl=0; } break; case 2: printf("请输入学生姓名:"); scanf("%s",&name); for(p=s;pname,name)==0) {j=1; if(xs==0) {printf("查询到的信息如下:\n"); xs++; printf(" 学号 姓名 性别 年龄 出生年月 地址 电话号码 mail\n");} printf("% -10ld% -9s% -5s% -6d% -11s% -11s% -15s% -20s\n",p->xuehao,p->name,p->sex,p->age,p->birth,p->address,p->phone,p->mail); }} if(j==0) { printf("\n\n查无此人!\n是否继续查询:(Y/N)"); char c; scanf("%s",&c); if(c=='y'||c=='Y') lgl=1; if(c=='n'||c=='N') lgl=0; } if(j==1) { j=0; printf("是否继续查询:(Y/N)"); char d; scanf("%s",&d); if(d=='y'||d=='Y') lgl=1; if(d=='n'||d=='N') lgl=0; } break; case 3: printf("请输入学生性别:"); scanf("%s",sex); for(p=s;psex,sex)==0) {j=1; if(xs==0) { printf("查询到的信息如下:\n"); xs++; printf(" 学号 姓名 性别 年龄 出生年月 地址 电话号码 mail\n");} printf("% -10ld% -9s% -5s% -6d% -11s% -11s% -15s% -20s\n",p->xuehao,p->name,p->sex,p->age,p->birth,p->address,p->phone,p->mail); }} if(j==0) { printf("\n\n查无此人!\n是否继续查询:(Y/N)"); char e; scanf("%s",&e); if(e=='y'||e=='Y') lgl=1; if(e=='n'||e=='N') lgl=0; } if(j==1) { j=0; printf("是否继续查询:(Y/N)"); char l; scanf("%s",&l); if(l=='y'||l=='Y') lgl=1; if(l=='n'||l=='N') lgl=0; } break; case 4: printf("请输入学生年龄:"); scanf("%d",&age); for(p=s;page==age) {j=1; if(xs==0) { printf("查询到的信息如下:\n"); xs++; printf(" 学号 姓名 性别 年龄 出生年月 地址 电话号码 mail\n");} printf("% -10ld% -9s% -5s% -6d% -11s% -11s% -15s% -20s\n",p->xuehao,p->name,p->sex,p->age,p->birth,p->address,p->phone,p->mail); }} if(j==0) { printf("\n\n查无此人!\n是否继续查询:(Y/N)"); char u; scanf("%s",&u); if(u=='y'||u=='Y') lgl=1; if(u=='n'||u=='N') lgl=0; } if(j==1) { j=0; printf("是否继续查询:(Y/N)"); char q; scanf("%s",&q); if(q=='y'||q=='Y') lgl=1; if(q=='n'||q=='N') lgl=0; } break; case 5: printf("请输入学生出生日期:"); scanf("%s",birth); for(p=s;pbirth,birth)==0) {j=1; if(xs==0) { printf("查询到的信息如下:\n"); xs++; printf(" 学号 姓名 性别 年龄 出生年月 地址 电话号码 mail\n");} printf("% -10ld% -9s% -5s% -6d% -11s% -11s% -15s% -20s\n",p->xuehao,p->name,p->sex,p->age,p->birth,p->address,p->phone,p->mail); } } if(j==0) { printf("\n\n查无此人!\n是否继续查询:(Y/N)"); char a; scanf("%s",&a); if(a=='y'||a=='Y') lgl=1; if(a=='n'||a=='N') lgl=0; } if(j==1) { j=0; printf("是否继续查询:(Y/N)"); char b; scanf("%s",&b); if(b=='y'||b=='Y') lgl=1; if(b=='n'||b=='N') lgl=0; } break; case 6: printf("请输入学生地址:"); scanf("%s",address); for(p=s;paddress,address)==0) {j=1; system("cls"); if(xs==0) { printf("查询到的信息如下:\n"); xs++; printf(" 学号 姓名 性别 年龄 出生年月 地址 电话号码 mail\n");} printf("% -10ld% -9s% -5s% -6d% -11s% -11s% -15s% -20s\n",p->xuehao,p->name,p->sex,p->age,p->birth,p->address,p->phone,p->mail); }} if(j==0) { printf("\n\n查无此人!\n是否继续查询:(Y/N)"); char a; scanf("%s",&a); if(a=='y'||a=='Y') lgl=1; if(a=='n'||a=='N') lgl=0; } if(j==1) { j=0; printf("是否继续查询:(Y/N)"); char b; scanf("%s",&b); if(b=='y'||b=='Y') lgl=1; if(b=='n'||b=='N') lgl=0; } break; case 7: lgl=0; break; }} }