搭建个场景:将学生的信息,以顺序表的方式存储(堆区),并且实现封装函数
1】顺序表的创建,
2】判满、
3】判空、
4】往顺序表里增加学生
5】遍历、
6】任意位置插入学生
7】任意位置删除学生
8】修改、
9】查找(按学生的学号查找)
10】去重、
11】销毁顺序表
头文件:seqStudent.h
#ifndef _SEQSTUDENT_H
#define _SEQSTUDENT_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXSTR 20 //最大字符串长度
#define MAX 100 //最大顺序表长度
typedef struct Student //定义存储学生信息的结构体
{
int id; //学号
char name[MAXSTR]; //学生姓名
int age; //年龄
}Student;
typedef Student DateType;
typedef struct seqStudents
{
DateType date[MAX]; //用数组来存放连续的数据
int len; //顺序表的长度
}seqStudents,*seqStudentsPtr; //顺序表的定义
//在堆区创建顺序表函数
seqStudentsPtr create();
//顺序表判满函数
int fill(seqStudentsPtr S);
//顺序表判空函数
int empty(seqStudentsPtr S);
//获取一条学生信息函数
DateType gete();
//往顺序表里面增加学生函数
int add(seqStudentsPtr S,DateType e);
//遍历顺序表函数
void show(seqStudentsPtr S);
//在任意指定下标位置插入学生函数
int insert(seqStudentsPtr S,int n,DateType e