first commit

master
2650279311@qq.com 6 years ago
parent 9a3c2c63b2
commit 074eb163e2

@ -146,7 +146,7 @@ void Inputstudent()
printf("请输入学生电话:\n"); printf("请输入学生电话:\n");
scanf("%s",pnewnode->stu.tel); scanf("%s",pnewnode->stu.tel);
printf("录入学生信息成功!\n\n"); printf("\n录入学生信息成功!\n\n");
@ -210,7 +210,7 @@ void Lookstudent()
system("color 1B"); system("color 1B");
char name[20]; char name[20];
char num[12]; char num[12];
int j=0;
node* p=phead;//定义一个当前节点 node* p=phead;//定义一个当前节点
system("cls"); system("cls");
system("color 2F"); system("color 2F");
@ -223,7 +223,7 @@ void Lookstudent()
printf("\t\t|\t\t\t\t2.按学号查找\t\t\t\t\t\t|\n"); printf("\t\t|\t\t\t\t2.按学号查找\t\t\t\t\t\t|\n");
printf("\t\t|\t\t\t\t0.退出查找系统\t\t\t\t\t\t|\n"); printf("\t\t|\t\t\t\t0.退出查找系统\t\t\t\t\t\t|\n");
printf("\t\t*****************************************************************************************\n"); printf("\t\t*****************************************************************************************\n");
printf("请输入\n\n"); printf("请输入查找的方式\n\n");
char ch=getch();//从键盘输入一个字符 char ch=getch();//从键盘输入一个字符
switch(ch) switch(ch)
{ {
@ -236,14 +236,15 @@ void Lookstudent()
if(strcmp(p->stu.name,name)==0) if(strcmp(p->stu.name,name)==0)
{ {
printf("\t\t*****************************************************************************************\n");
printf("\t\t|学号\t|姓名\t|性别\t|年龄\t|生日\t|家庭住址\t\t|本人电话\t\t|\n");
printf("\t\t|---------------------------------------------------------------------------------------|\n"); printf("\t\t|---------------------------------------------------------------------------------------|\n");
printf("\t\t|%d\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel); printf("\t\t|%s\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel);
printf("\t\t*****************************************************************************************\n"); printf("\t\t*****************************************************************************************\n");
} }
p=p->pnext; p=p->pnext;
j++;
} }
break; break;
@ -255,14 +256,15 @@ printf("\t\t********************************************************************
if(strcmp(p->stu.num,num)==0) if(strcmp(p->stu.num,num)==0)
{ {
printf("\t\t*****************************************************************************************\n");
printf("\t\t|学号\t|姓名\t|性别\t|年龄\t|生日\t|家庭住址\t\t|本人电话\t\t|\n");
printf("\t\t|---------------------------------------------------------------------------------------|\n"); printf("\t\t|---------------------------------------------------------------------------------------|\n");
printf("\t\t|%d\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel); printf("\t\t|%s\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel);
printf("\t\t*****************************************************************************************\n"); printf("\t\t*****************************************************************************************\n");
} }
p=p->pnext; p=p->pnext;
j++;
} }
break; break;
@ -273,7 +275,7 @@ printf("\t\t********************************************************************
printf("您输入有误,请重新输入!\n\n"); printf("您输入有误,请重新输入!\n\n");
break; break;
} }
if(j==count) if(count==0)
{ {
printf("没有您要查找的学生信息!\n\n"); printf("没有您要查找的学生信息!\n\n");
@ -286,23 +288,23 @@ void Modifystudent()
system("cls"); system("cls");
system("color 1B"); system("color 1B");
char name[20]; char name[20];
int j=0;
node* p=phead;//定义一个当前节点 node* p=phead;//定义一个当前节点
printf("请输入要修改的学生姓名:\n"); printf("\n\n请输入要修改的学生姓名:\n\n");
scanf("%s",name); scanf("%s",name);
while(p!=NULL) while(p!=NULL)
{ {
if(strcmp(p->stu.name,name)==0) if(strcmp(p->stu.name,name)==0)
{ {
printf("\t\t*****************************************************************************************\n");
printf("\t\t|学号\t|姓名\t|性别\t|年龄\t|生日\t|家庭住址\t\t|本人电话\t\t|\n");
printf("\t\t|---------------------------------------------------------------------------------------|\n"); printf("\t\t|---------------------------------------------------------------------------------------|\n");
printf("\t\t|%d\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel); printf("\t\t|%s\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel);
printf("\t\t*****************************************************************************************\n"); printf("\t\t*****************************************************************************************\n");
printf("请修改学生信息!"); printf("请修改学生信息!\n\n");
printf("\n");
printf("请输入学生学号:\n"); printf("请输入学生学号:\n");
scanf("%d",p->stu.num); scanf("%s",p->stu.num);
printf("请输入学生姓名:\n"); printf("请输入学生姓名:\n");
scanf("%s",p->stu.name); scanf("%s",p->stu.name);
@ -322,19 +324,22 @@ void Modifystudent()
printf("请输入学生电话:\n"); printf("请输入学生电话:\n");
scanf("%s",p->stu.tel); scanf("%s",p->stu.tel);
printf("修改学生信息成功!\n\n"); printf("\n修改学生信息成功!\n\n");
system("pause"); system("pause");
system("cls"); system("cls");
printf("\t\t*****************************************************************************************\n");
printf("\t\t|学号\t|姓名\t|性别\t|年龄\t|生日\t|家庭住址\t\t|本人电话\t\t|\n");
printf("\t\t*****************************************************************************************\n");
printf("\t\t|---------------------------------------------------------------------------------------|\n"); printf("\t\t|---------------------------------------------------------------------------------------|\n");
printf("\t\t|%d\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel); printf("\t\t|%s\t|%s\t|%s\t|%d\t|%s\t|%s\t\t|%s\t\t|\n",p->stu.num,p->stu.name,p->stu.sex,p->stu.age,p->stu.birth,p->stu.home,p->stu.tel);
printf("\t\t*****************************************************************************************\n"); printf("\t\t*****************************************************************************************\n");
} }
p=p->pnext; p=p->pnext;
j++;
} }
if(j==count) if(count==0)
{ {
printf("没有您要修改的学生信息!\n\n"); printf("没有您要修改的学生信息!\n\n");
} }
@ -361,7 +366,7 @@ void Readstudent()
p=p->pnext; p=p->pnext;
} }
printf("数据读取完毕!!!\n\n"); printf("\n\n数据读取完毕!!!\n\n");
fclose(fp); fclose(fp);
} }
@ -371,7 +376,7 @@ void Deletestudent()
system("cls"); system("cls");
system("color 6A"); system("color 6A");
char name[20]; char name[20];
int j=0;
node* p=phead;//定义一个当前节点 node* p=phead;//定义一个当前节点
printf("\n\n请输入要删除的学生姓名:\n"); printf("\n\n请输入要删除的学生姓名:\n");
scanf("%s",name); scanf("%s",name);
@ -383,11 +388,10 @@ void Deletestudent()
p=p->pnext; p=p->pnext;
printf("删除学生信息成功!\n\n"); printf("删除学生信息成功!\n\n");
} }
p=p->pnext;
p=p->pnext;
j++;
} }
if(j==count) if(count==0)
{ {
printf("没有您要删除的学生信息!\n\n"); printf("没有您要删除的学生信息!\n\n");
} }

Loading…
Cancel
Save