C語言順序表功能實現

2021-09-24 02:23:58 字數 1629 閱讀 2683

#include

#include

#include

typedef

int datetype;

typedef

struct seqlist

seqlist;

void

seqlistinit

(seqlist* ps)

//初始化函式

void

seqlistcheck

(seqlist* ps)

//檢查容量函式,不夠擴容

}void

seqlistdestory

(seqlist* ps)

//刪除函式

void

seqlistpushback

(seqlist* ps, datetype x)

void

seqlistpushfront

(seqlist* ps, datetype x)

ps->arr[0]

= x;

ps->size++;}

void

seqlistprint

(seqlist* ps)

printf

("\n");

}void

seqlistpopback

(seqlist* ps)

void

seqlistpopfront

(seqlist* ps)

ps->size--;}

void

seqlistinsert

(seqlist* ps, size_t pos, datetype x)

ps->arr[pos]

= x;

ps->size++;}

void

seqlisterase

(seqlist* ps, size_t pos)

ps->size--;}

size_t seqlistfind

(seqlist* ps, datetype x)

//查詢x的位置

}return-1

;}datetype seqlistat

(seqlist* ps, size_t pos)

//查詢當前位置的值

void

seqlistbubblesort

(seqlist* ps)

//氣泡排序}}

}void

menu()

//選單函式

void

choose()

//選擇函式

case2:

case3:

case4:

case5:

case6:

case7:

case8:

case2:

}break;}

case9:

case10:

default

:printf

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

break;}

}}intmain()

本程式需要使用者先採用插入的方式進行順序表內容的初始化,然後實現個功能函式。使用者進入選單選擇,根據不同的選擇呼叫不同功能。

Python 實現秒錶功能

python 實現秒錶功能 以下例項使用 time 模組來實現秒錶功能 例項 import time print 按下回車開始計時,按下 ctrl c 停止計時。while true try input 如果是 python 2.x 版本請使用 raw input starttime time.ti...

C語言實現的迴圈單鏈表功能示例

sclist.h ifndef sclist h define sclist h include include include typedef int elemtype typedef struct node node,pnode typedef struct list list void ini...

通訊錄(用鍊錶功能實現)

include include include typedef struct peoplepeople void create people l 尾插法建立鍊錶 people p,r int i r l for i 0 i 5 i p people malloc sizeof people prin...