最近,在准备找工作,看到了单链表这里,就自己试着用单链表编写了一个学生信息管理系统。自己水平不高,很简单的一个小系统,贴出来请大家帮我指出错误,请大家指教!谢谢!
// 学生信息系统.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <conio.h> using namespace std; #define LEN sizeof(struct student_list)//结构体的长度 struct student_list { int num;//学号 double score;//分数 struct student_list* next;//指向下一节点的指针 }; /********************************************学生信息系统*********************************************************** ***名称:学生信息系统 ***功能:1.录入学生信息 2.增添学生信息 3.删除学生信息 4.查找学生信息 5.排列学生信息 6.修改学生信息 7.安全退出系统 ***所使用的函数及作用: int GetKey():读取按键的值,判断选择了哪一项功能 void ShowMenu():介绍学生信息系统的功能及对应的按键 int print_list(struct student_list* list_head):打印学生的信息 struct student_list* create_list():录入学生信息 struct student_list* insert_list_node(struct student_list* list_head, struct student_list* list_student):增添学生的信息 struct student_list* delete_list_node(struct student_list* list_head, int position):删除学生的信息 struct student_list* sort_list(struct student_list* list_head):冒泡法排列学生信息(按照学号从小到大排列) struct student_list* find_node(student_list* list_head, int stu_num):查找节点信息根据学号 int find_stu_node(student_list* list_head, int stu_num):查找修改的学生是否在链表中已经存在 struct student_list* modify_node(student_list* list_head, int num_old, int num_new, int socre_new):修改学生信息 ************************************************************************************************************************/ /************************************ ***功能:读取按键,判断选择了哪一项功能 ***返回:void ************************************/ int GetKey() { int press_key; press_key = getch();//功能键需要读两次值 return press_key; } /********************************* ***函数名称:ShowMenu ***函数说明:介绍学生信息系统的功能及对应的按键 ***函数返回:void *********************************/ void ShowMenu() { cout<<" 学 生 成 绩 管 理 系 统 "<<endl; cout<<" 1.录入学生信息 "<<endl; cout<<" 2.增添学生信息 "<<endl; cout<<" 3.删除学生信息 "<<endl; cout<<" 4.查找学生信息 "<<endl; cout<<" 5.排列学生成绩 "<<endl; cout<<" 6.修改学生信息 "<<endl; cout<<" 7.安全退出系统 "<<endl; cout<<"请选择:"; } /********************************* ***功能:创建n个节点的链表 ***返回:指向链表表头的指针 *********************************/ struct student_list* creat_list() { cout << " 欢迎使用万花筒学生信息系统! " << endl; cout << " 请输入学生的学号