順序表 學生資訊管理

2021-09-24 21:31:10 字數 1838 閱讀 1282

typedef int status;

typedef struct

student;

typedef student elemtype;

typedef struct

sqlist;

分配記憶體,此時長度設為0。

status initlist(sqlist *l)   // 初始化 

int findbystuid(sqlist &l) // 根據學號查詢,返回該同學在順序表中的編號 

return 0;

}

status listinsert(sqlist &l,int i,elemtype data) // 在 i位置插入

l.elem[i]=data;

l.length++;

return 1;

}

status listdelete(sqlist &l,int i) // 		刪除 i位置的學生資訊 

l.length--;

return 1;

}

#include#include#include#define maxsize 10

int num;

typedef int status;

typedef struct

student;

typedef student elemtype;

typedef struct

sqlist;

status initlist(sqlist *l) // 初始化

void getelem(sqlist &l,int i) // 訪問順序表

void input(elemtype *e)

void input(sqlist &l)

l.length=num;

}void output(sqlist &l)

}int findbystuid(sqlist &l) // 根據學號查詢,返回該同學在順序表中的編號

return 0;

}elemtype findbynum(sqlist &l) // 根據序號查詢,返回該同學的資訊

status listinsert(sqlist &l,int i,elemtype data) // 在 i位置插入

l.elem[i]=data;

l.length++;

return 1;

}void listinsert(sqlist &l)

else }

status listdelete(sqlist &l,int i) // 刪除 i位置的學生資訊

注意:此程式沒有太在意資料校驗,亂輸入可能有bug。

學生資訊管理系統 順序表

定義乙個包含學生資訊 學號,姓名,成績 的的 順序表,使其具有如下功能 1.1根據指定學生個數,逐個輸入學生資訊 1.2逐個顯示學生表中所有學生的相關資訊 1.3根據姓名進行查詢,返回此學生的學號和成績 1.4根據指定的位置可返回相應的學生資訊 學號,姓名,成績 1.5給定乙個學生資訊,插入到表中指...

學生資訊管理表

建立表資料庫命名 create database if not exists xueshengbiao default charset utf8 use xueshengbiao 資料庫結構表 create table xuesheng id int unsigned key auto increm...

順序表練習 C 學生資訊管理系統

c 順序表簡單實現學生資訊管理系統,未加入檔案輸入輸出流,介面較簡單,編譯通過 include include include include using namespace std define maxsize 100 define overflow 2 define error 1 define...