You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
program/student.h

34 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

undefined
#include <string>
#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);//运用直接插入法进行排序,顺序从小到大