運用鍊錶和佇列實現停車場的一些簡易功能

2021-08-15 04:30:08 字數 1377 閱讀 7716

#include

#include

#include

#include

#include

#define ok 1

#define error 0

#define true 1

#define false 0

#define maxsize 20

#define n 10

#define len sizeof(qnode)

typedef int status;

typedef int qelemtype;

typedef struct qnode//定義乙個結構體

qnode,*queueptr;

typedef struct

linkqueue;

linkqueue* creatqueue()//建立佇列

return q;

}status print1(queueptr front)//列印資訊}}

qnode* linklist(queueptr front)//建立鍊錶

p2 -> next = null;

p3 =  head->next;//簡易氣泡排序

p5 = head;

while(p3->next != null)//p3是大迴圈

else//交換p3與p4節點的位置

p4 = p3;//使p3與p4指向對方的節點

p3 = p5->next;

}p4 = p4->next;

p6 = p6->next;

}p3 = p3->next;

p5 = p5->next;

}return head;

}/*void select(queueptr head)//選擇排序

}if(p4 != p2->next)//當p4和p2->next不指向同一位置時交換

p2 = p2->next;

p2->place = ++i;//分配車位

}while(p6 != null)

int print2(queueptr head)

}int visit(queueptr head)

if(p == null)

printf("查無此人!");

else

printf("%s,%s,%d\n",p->name,p->numb,p->vip);

}queueptr de(queueptr head)

if(p == null)

printf("查無此人!");

else

return head;

}int main()

}return ok;

}

SDUT refresh的停車場(棧和佇列)

refresh近期發了一筆橫財,開了一家停車場。因為土地有限,停車場內停車數量有限,可是要求進停車場的車輛過多。當停車場滿時,要進入的車輛會進入便道等待。最先進入便道的車輛會優先 進入停車場,並且停車場的結構要求僅僅出去的車輛必須是停車場中最後進去的車輛。現告訴你停車場容量n以及命令數m,以及一些命...

停車場管理(棧和佇列的應用)

設停車場是乙個可以停放n輛汽車的狹長通道,且只有乙個大門可供汽車進出。汽車在停車場內按車輛到達時間的先後順序,依次有北向南排列 大門在最南端,最先到達的第一車停放在車場的最北端 若車場內已停滿n輛車,那麼後來的車只能在門外的便道上等候,一旦有車開走,則排在便道上的第一輛車即可開入 當停車場內某輛車要...

基於資料結構中的佇列與棧實現的停車場管理程式

這是是停車場管理程式主要運用了資料結構中的佇列與棧的組合 先來看看效果 define maxsize 20 控制停車場停車的車輛數 typedef int elemtype int h 0 用來記錄停車場停幾輛車 elemtype e int k 0 記錄結構體的次序 int sa 2 int h ...