From 074eb163e24a52b0bdcc7ae2aa09592ee968d3dd Mon Sep 17 00:00:00 2001 From: "2650279311@qq.com" <2650279311@qq.com> Date: Wed, 9 Jan 2019 15:07:32 +0800 Subject: [PATCH] first commit --- main.c | 60 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/main.c b/main.c index 44d587e..38fe18f 100644 --- a/main.c +++ b/main.c @@ -146,7 +146,7 @@ void Inputstudent() printf("请输入学生电话:\n"); scanf("%s",pnewnode->stu.tel); - printf("录入学生信息成功!\n\n"); + printf("\n录入学生信息成功!\n\n"); @@ -210,7 +210,7 @@ void Lookstudent() system("color 1B"); char name[20]; char num[12]; - int j=0; + node* p=phead;//定义一个当前节点 system("cls"); 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\t0.退出查找系统\t\t\t\t\t\t|\n"); printf("\t\t*****************************************************************************************\n"); - printf("请输入:\n\n"); + printf("请输入查找的方式:\n\n"); char ch=getch();//从键盘输入一个字符 switch(ch) { @@ -236,14 +236,15 @@ void Lookstudent() 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|%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"); } p=p->pnext; - j++; + } break; @@ -255,14 +256,15 @@ printf("\t\t******************************************************************** 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|%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"); } p=p->pnext; - j++; + } break; @@ -273,7 +275,7 @@ printf("\t\t******************************************************************** printf("您输入有误,请重新输入!\n\n"); break; } - if(j==count) + if(count==0) { printf("没有您要查找的学生信息!\n\n"); @@ -286,23 +288,23 @@ void Modifystudent() system("cls"); system("color 1B"); char name[20]; - int j=0; + node* p=phead;//定义一个当前节点 - printf("请输入要修改的学生姓名:\n"); + printf("\n\n请输入要修改的学生姓名:\n\n"); scanf("%s",name); while(p!=NULL) { 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|%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("请修改学生信息!"); - printf("\n"); + printf("请修改学生信息!\n\n"); printf("请输入学生学号:\n"); - scanf("%d",p->stu.num); + scanf("%s",p->stu.num); printf("请输入学生姓名:\n"); scanf("%s",p->stu.name); @@ -322,19 +324,22 @@ void Modifystudent() printf("请输入学生电话:\n"); scanf("%s",p->stu.tel); - printf("修改学生信息成功!\n\n"); + printf("\n修改学生信息成功!\n\n"); 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|%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"); } p=p->pnext; - j++; + } - if(j==count) + if(count==0) { printf("没有您要修改的学生信息!\n\n"); } @@ -361,7 +366,7 @@ void Readstudent() p=p->pnext; } - printf("数据读取完毕!!!\n\n"); + printf("\n\n数据读取完毕!!!\n\n"); fclose(fp); } @@ -371,7 +376,7 @@ void Deletestudent() system("cls"); system("color 6A"); char name[20]; - int j=0; + node* p=phead;//定义一个当前节点 printf("\n\n请输入要删除的学生姓名:\n"); scanf("%s",name); @@ -383,11 +388,10 @@ void Deletestudent() p=p->pnext; printf("删除学生信息成功!\n\n"); } - p=p->pnext; - -j++; + +p=p->pnext; } - if(j==count) + if(count==0) { printf("没有您要删除的学生信息!\n\n"); }