print_table_head(); if(head==NULL) { printf(\ } for(p=head;p;p=p->next) { printf(\jiegou); printf(\ printf(\按Enter键返回主菜单)\\n\ getchar(); r=getchar(); if(r!='1') { system(\ Print_menu_main(); } else { system(\ Print_menu_main(); } }
struct student *search_by_name(struct student *head)//按姓名查找 { char name[10]; struct student *p=head; char continue_input; /*int isfound=0;*/ printf(\请输入要查找的姓名:\ scanf(\ printf(\查找%s\\n\ print_table_head(); while(p!=NULL) { if(strcmp(p->name,name)==0) { print_table_row(p); p=p->next; /* isfound=1; */ break;
} p=p->next; } print_table_bottom(); printf(\是否继续查找?(Y 继续;N 返回主菜单)\\n\ getchar(); continue_input=getchar(); if(continue_input=='n'||continue_input=='N') { system(\ Print_menu_main(); } else search_by_name(head); }
struct student * search_by_id(struct student *head)//按学号查找 { int id; struct student *p=head; char continue_input; /*int isfound=0;*/ printf(\请输入要查找的学号:\ scanf(\ printf(\查找%d\\n\ print_table_head(); while(p!=NULL) { if(p->num==id) { print_table_row(p); p=p->next; /*isfound=1;*/ break; } p=p->next; } print_table_bottom(); printf(\是否继续查找?(Y 继续;N 返回主菜单)\\n\ getchar(); continue_input=getchar();
if(continue_input=='n'||continue_input=='N') { system(\ Print_menu_main(); } else search_by_id(head); return head; }
struct student*modify_record_by_id(struct student*head)//按学号修改 { struct student *p=head; int id; char continue_input; printf(\请输入要修改的学生的学号:\\n\ scanf(\ while(p!=NULL) { if(p->num==id) break; p=p->next; } if(p==NULL) printf(\抱歉,没有学号为%d的学生\\n\ else { printf(\请输入学生信息:\\n\ printf(\学号:\ printf(\姓名:\ printf(\出生年月:\ printf(\请输入学生成绩:\\n\ printf(\语言:\ printf(\数据结构:\ print_table_head();print_table_row(p);print_table_bottom();} printf(\继续修改学生信息吗?Y 继续;N 返回主菜单\\n\ getchar(); continue_input=getchar(); if(continue_input=='y'||continue_input=='Y') creat_by_input(); else { system(\ Print_menu_main();
} return head; }
struct student*modify_record_by_name(struct student*head)//按姓名修改 { struct student*p=head; char name[10]; char continue_input; printf(\请输入要修改的学生的姓名:\\n\ scanf(\ while(p!=NULL) { if(strcmp(p->name,name)==0) break; p=p->next; } if(p==NULL) printf(\抱歉,没有姓名为%s的学生\\n\ else { printf(\请输入学生信息:\\n\ printf(\学号:\ printf(\姓名:\ printf(\出生年月:\ printf(\请输入学生成绩:\\n\ printf(\语言:\ printf(\数据结构:\ print_table_head();print_table_row(p);print_table_bottom();} printf(\继续修改学生信息吗?Y 继续;N 返回主菜单\\n\ getchar(); continue_input=getchar(); if(continue_input=='y'||continue_input=='Y') creat_by_input(); else { system(\ Print_menu_main(); } return head; }
struct student *insert_record(struct student *head)//插入 {