|
|
|
@ -57,6 +57,18 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '6':
|
|
|
|
|
demand();
|
|
|
|
|
break;
|
|
|
|
|
case '7':
|
|
|
|
|
if(cpassword()!=1){
|
|
|
|
|
out();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '8':
|
|
|
|
|
out();
|
|
|
|
|
return 0;
|
|
|
|
|
default:
|
|
|
|
|
system("cls");
|
|
|
|
|
end();
|
|
|
|
@ -86,6 +98,9 @@ void menus()
|
|
|
|
|
printf("\t\t\t\t*--------3 学生基本信息保存--------------*\n");
|
|
|
|
|
printf("\t\t\t\t*---4 学生基本信息删除(此选项须输入密码)-*\n");
|
|
|
|
|
printf("\t\t\t\t*---5 学生基本信息修改(此选项须输入密码)-*\n");
|
|
|
|
|
printf("\t\t\t\t*--------6 学生基本信息查询--------------*\n");
|
|
|
|
|
printf("\t\t\t\t*------------7 密码修改------------------*\n");
|
|
|
|
|
printf("\t\t\t\t*------------8 退出系统------------------*\n");
|
|
|
|
|
printf("\t\t\t\t******************************************\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -271,6 +286,100 @@ int alter()
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void demand()
|
|
|
|
|
{
|
|
|
|
|
int choice;
|
|
|
|
|
while(1){
|
|
|
|
|
while(1){
|
|
|
|
|
system("cls");
|
|
|
|
|
_menus();
|
|
|
|
|
printf("请输入正确选项!\n");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
if(choice<6&&choice>0)break;
|
|
|
|
|
}
|
|
|
|
|
struct node tem[1000];
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("data.txt","r");
|
|
|
|
|
if(fp==NULL){
|
|
|
|
|
printf("文件打开失败!\n");
|
|
|
|
|
end();
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
int i=0;
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
int sum=i;
|
|
|
|
|
char d[20];
|
|
|
|
|
int c;
|
|
|
|
|
int fa=1;
|
|
|
|
|
switch(choice){
|
|
|
|
|
case 1:
|
|
|
|
|
printf("请输入学号:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
printf("\n");
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(strcmp(d,tem[i].stnum)==0){
|
|
|
|
|
printf("学号:%s\t姓名:%s\t性别:%s\t年龄:%d\t备注:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
printf("请输入姓名:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
printf("\n");
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(strcmp(d,tem[i].stname)==0){
|
|
|
|
|
printf("学号:%s\t姓名:%s\t性别:%s\t年龄:%d\t备注:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
printf("请输入性别:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
printf("\n");
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(strcmp(d,tem[i].sex)==0){
|
|
|
|
|
printf("学号:%s\t姓名:%s\t性别:%s\t年龄:%d\t备注:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
printf("请输入年龄:");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
printf("\n");
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(c==tem[i].age){
|
|
|
|
|
printf("学号:%s\t姓名:%s\t性别:%s\t年龄:%d\t备注:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
if(fa==0)printf("此次查询无有效信息!\a\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _menus()
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t\t\t********选择你需要的查询********\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------1 按学号查询----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------2 按姓名查询----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------3 按性别查询----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------4 按年龄查询----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------5 退出查询------------*\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _menus2()
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t\t\t*********请选择修改方式*******\n");
|
|
|
|
@ -414,4 +523,3 @@ int password()
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|