diff --git a/student.h b/student.h index 66dc905..743fa06 100644 --- a/student.h +++ b/student.h @@ -1 +1,33 @@ -undefined \ No newline at end of file +undefined +#include +#define MAXSIZE 100//最大存储个数 +#define OK 1 +#define ERROR 0 +#define OVERFLOW -1 +using namespace std; +typedef int Status; +//学生信息管理系统存储结构: +typedef struct { + string name;//学生姓名 + string number;//学号,统一用5位数字,位数不够用0补齐,例如00001,00002 + int score;//成绩 + int key;//关键字,用于对学号进行排序,若学号为00001,则key为1;若学号为00101,则key为101 + int OtherInfo;//用于添加其他信息 +}InfoNode, * InfoPtr;//指向学生信息结点的指针变量 + +typedef struct { + InfoPtr student;//student作为动态数组的首地址 + int length;//学生信息表当前学生个数 +}DataBase; + +//函数声明: +Status Init(DataBase& SQL);//初始化学生信息表,申请动态数组空间 +Status Create(DataBase& SQL);//根据学生人数,逐个输入学生信息 +void OutInfo(DataBase SQL);//逐个显示学生信息表中所有学生的相关信息 +Status Insert(DataBase& SQL, int seat,string NAME,string NUMBER,int SCORE);//将指定的学生信息插入指定位置,seat为插入位置的数组下标 +Status Delete(DataBase& SQL, int seat);//删除指定位置的学生记录,seat为其数组下标 +void StuNum(DataBase SQL);//统计学生表中学生个数,即SQL.length +Status BiSearch(DataBase SQL, string NUMBER);//根据学号(折半查找)进行查找,如果成功,返回其姓名和成绩 +Status Clear(DataBase& SQL);//清空学生信息表 +Status Destroy(DataBase& SQL);//销毁学生信息表 +void NumSort(DataBase& SQL);//运用直接插入法进行排序,顺序从小到大