單鏈表實現學生資訊管理系統

2021-10-23 07:14:37 字數 2394 閱讀 2316

#define _crt_secure_no_warnings

#include

#include

#include

int count =0;

typedef

struct

student;

typedef

struct node node;

node*

createlinklist()

//建立指標鍊錶

headnode->next =

null

;return headnode;

}node*

createnode

(student data)

//建立結點

newnode->data = data;

newnode->next =

null

;return newnode;

}/*插入資訊*/

void

insertnodebyhead

(node* headnode, student data)

//頭插法

/*刪除資訊*/

void

(node* headnode,

char

*name)

while

(strcmp

(posnode->data.name,name))}

posfrontnode->next = posnode->next;

free

(posnode);}

/*查詢資訊*/

node*

searchinfobydata

(node* headnode,

char

* name)

while

(strcmp

(moveptr->data.name, name)

)return moveptr;

}//鍊錶儲存

void

readinfofromfile

(node* headnode,

char

*filename)

files

fclose

(fp);}

//鍊錶的讀取

void

writeinfofromfile

(node* headnode,

char

* filename)

fclose

(fp);}

//列印鍊錶

void

printlist

(node* headnode)

printf

("共有%d名學生\n"

, count)

;printf

("\n");

}

#include

"mylist.h"

void

menu()

/*選單介面*/

node* list =

createlinklist()

;void

inputchoice()

/*使用者互動*/

else

break

;case4:

printf_s

("* 【 4.修改資訊 】 *\n");

printf

("請輸入修改學生的學號");

scanf

("%s"

, data.no)

;(list, data.no)

;printf

("請輸入你想新增的學生學號、姓名、成績\n");

scanf

("%s%s%d\n"

, data.no, data.name,

&data.score)

;getchar()

;insertnodebyhead

(list, data)

;break

;case5:

printf_s

("* 【 5.顯示資訊 】 *\n");

printlist

(list)

;default

:printf

("選擇錯誤,重新輸入\n");

system

("pause");

break;}

}int

main

(void

)system

("pause");

return0;

}

單鏈表學生資訊管理系統

include include include 一 建立結構體 typedef struct lnode l 定義結構體型別為 l l creat void addlink void findbyid void delbyid void findall void alterinfo l creat ...

python函式實現學生資訊管理系統

名片管理系統 dict1 i 0 def display menu 選單顯示函式 print 名片管理系統 center 20 print 30 print 1.新增個人名片 end print 2.刪除個人名片 end print 3.修改個人名片 print 4.檢視個人名片 end print...

使用單向鍊錶實現學生資訊管理系統

全部 實現的功能 選單介面 please enter your choice 1 exit.2 add all students.3 show all students.4 add a studeng.5 remove a studeng.用來存放學生資訊的結構體 9 學生分數的結構體 10type...