使用栈和队列实现的狭长停车场管理


1、情况说明: 
(1)停车场结构为一条狭长的通道(可视为栈)。 
(2)若停车场内车辆已经停满,后来的车需要在路边排队等待,库内有车出来才能入库    (可视为队列)。 
(3)使用A代表入库,D代表出库,车辆信息包括入库时间和车牌。


2、数据定义

#define M 3//车库能停几辆车,在这里定义
//-----------------///--------------------///--------------------//
typedef struct {int num;int ID;int arrivetime;
}carinformation;
//定义停车场的结构体
typedef struct parkinglot {carinformation stack[M];int top;
}carpark;//定义栈结构
//-----------------///--------------------///--------------------//
//--------------------///--------------------///--------------------//
typedef struct carnode {int num;int ID;int arrivetime;//struct node *next;
}qptr;
//定义外面狭长路的队列
typedef struct {qptr *front, *rear;
}carqueue;
//--------------------///--------------------///--------------------//
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

3、初始化栈和队列函数

carpark *initstack()
{carpark *T;T = (carpark *)malloc(sizeof(carpark));if (T == NULL){/*地址分配错误直接退出程序,不能继续了*/system("cls");printf("\n\n\t因为内存空间问题,导致程序出错!即将退出!\n\n");system("pause");exit(0);}T->top = -1;return T;
}
//初始化停车场
carqueue *initqueue()
{carqueue *L;L = (carqueue *)malloc(sizeof(carqueue));L->front = (carqueue *)malloc(sizeof(carqueue));if (L == NULL||L->front == NULL){/*地址分配错误直接退出程序,不能继续了*/system("cls");printf("\n\n\t因为内存空间问题,导致程序出错!即将退出!\n\n");system("pause");exit(0);}if (L->front == NULL);L->front->next = NULL;L->rear = L->front;return L;
}
//初始化路边停车位
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

4、算法实现 
先上代码后解释:

/*
下面是整个程序的核心内容
主要实现了进入车库和路边等待的调用
两个表的地址需要传过来
车库表和路边队列表;
carinter(char _array, int num, int time,carpark *P,carqueue *L)
carinter(进库还是出库char A/D ,车牌号int , 到达时间int ,carpark *P 车库表 ,carqueue *L 路边表)
*/
int carinter(char _array, int num, int time,carpark *P,carqueue *L)
{if (_array == 'A'){if (parkfull(P) == 1){int temp;//这里写车库满后进入队列的codeprintf("\t车牌为:%d的车辆,已进入路边等待!\n\n",num);temp = carroadsaid(time, num, L);if (temp == 0){/*地址分配错误直接退出程序,不能继续了*/system("cls");printf("\n\n\t因为内存空间问题,导致程序出错!即将退出!\n\n");system("pause");exit(0);}return 1;}else{int _top;printf("\t车牌为:%d的车辆,已进入车库!\n\n",num);_top = ++P->top;P->stack[_top].arrivetime = time;P->stack[_top].ID = num;P->stack[_top].num = internum++;return 1;}}else if (_array == 'D'){//这里是出库codeoutparking(num, time, P, L);return 2;//返回2,不清楚是否成功,只是返回一个数,错误在函数内判断}else//读取的char是个非法值,所以返回错误{return 0;}
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51

解释: 
(1)函数调用方法为: 
carinter(char _array, int num, int time,carpark *P,carqueue *L) 
第一个参数char _array为车辆是进入还是出去,第二个参数num是车牌号,第三个time是到达/离去时间(假设为int),后面两个参数为栈表和队列表的地址。 
(2)首先判断_array是 A 入库还是 D 出库。如果为入库,就再接一个IF判断函数用于判出库是否已满(栈是否满),车满判断函数如下:

int parkfull(carpark *P)
{if (P->top == M - 1)return 1;elsereturn 0;
}
//车满判断
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

如果车位没有满,就执行上面入库核心代码else里面的函数直接执行入栈操作。ps:车满是if内的,未满写在了else里面。 
(3)对于库满的操作: 
调用入队操作函数,carroadsaid(),参数明白撒~

/*
路边等待队列分配
carroadsaid(int time, int ID, carqueue *L)
carroadsaid(时间, 车牌, carqueue *L 队列表)
*/
int carroadsaid(int time, int ID, carqueue *L)
{qptr *T;T = (qptr *)malloc(sizeof(qptr));if (T == NULL) return 0;//地址分配失败,返回失败T->num = outsidenum++;T->ID = ID;T->arrivetime = time;T->next = NULL;L->rear->next = T;L->rear = T;return 1;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

4、出库运算:

/*
这里是出库的核心函数
具体使用如下:
通过ID(车牌)寻找库内ID(车牌),如果不位于库顶(栈顶),就转移前方车辆至临时路边等待
出库后,计算停车时间,并将外面临时等待的车重新放入车库
如果入库后仍有空位,就将外面的等待队列添加进库,直到库满(栈满)
outparking(int ID, int time, carpark *P, carqueue *L)
outparking(车牌ID, 出库时间int , carpark *P 库表, carqueue *L 队列表)
*/
int outparking(int ID, int time, carpark *P, carqueue *L)
{int down = M-1;while (down >= 0){if (P->stack[down].ID == ID)//找到位置{if (down == P->top)//车在最外面{//这里是车在最外面的codeprintf("\t\n车牌为%d的,已出库!停车时间:%d,请按标准收费!\n\n", P->stack[down].ID, time - P->stack[down].arrivetime);P->stack[down].ID = P->stack[down].arrivetime = P->stack[down].num = -1;//清空位置--internum;//库内记数减一个--P->top;while (parkfull(P) == 0)//出库后再看有空位没有{//有空位就把等待队列的第一个放进来,且重新输入进入时间//出队操作int _time;qptr *temp;if (L->front == L->rear || L->front->next == NULL) return 0;//队列是空的,直接返回就好temp = L->front->next;P->stack[++P->top].num = internum++;P->stack[P->top].ID = temp->ID;printf("\t\t\n\n车库有空位,请输入队列此车(车牌为:%d)当前入库时间:", temp->ID);scanf("%d", &_time);P->stack[P->top].arrivetime = _time;printf("\n\t此车已在队列中等待:%d time,现已进入车库!\n\n", _time - temp->arrivetime);/*调整队头指针位置,并释放内存空间*/L->front->next = temp->next;if (L->rear == temp) L->rear = temp;//对于队列只剩一个数据时的队头调整outsidenum--;free(temp);}//outqueue(ID, time, P, L);//库空填充函数return 1;}else {//这里是车不在最外的code//down变量就是当前找到的位置,已经是数组了,不用减1carpark *temp;int x;temp = initstack();//初始化临时停车场P->top = down;//P表的top现在直接调整到找到元素那里for (x=M-1; x >down; x--){temp->stack[++temp->top].ID = P->stack[x].ID;temp->stack[temp->top].arrivetime = P->stack[x].arrivetime;temp->stack[temp->top].num = P->stack[x].num;}//往临时停车场停车printf("\t\n车牌为%d的,已出库!停车时间:%d,请按标准收费!\n\n", P->stack[down].ID, time - P->stack[down].arrivetime);//P->stack[down].ID = P->stack[down].arrivetime = P->stack[down].num = -1;//清空位置--internum;//库内记数减一个--P->top;//移动top指针while (temp->top >= 0){if (temp->stack[temp->top].num != -1) //判断是否已经取到原栈高度,也就是不用复制-1值过来,要不然top位置会错位{P->stack[++P->top].ID = temp->stack[temp->top].ID;P->stack[P->top].arrivetime = temp->stack[temp->top].arrivetime;P->stack[P->top].num = temp->stack[temp->top].num;temp->top--;//temp表top位置改变//P->top++;//P表top位置改变}else{break;//顶上是空不再复制过来}}//重新放回车库for (x = P->top+1; x < M; x++)P->stack[x].arrivetime = P->stack[x].ID = P->stack[x].num = -1;//向上清空车库/*这里应该还要判断车库有空位,所以放上面的代码过来要改成单独的函数,要不然太长了不具有独立性===========================================================================int _num, _time;qptr *temp;if (L->front == L->rear || L->front->next == NULL) return 0;//队列是空的,直接返回就好temp = L->front->next;P->stack[++P->top].num = internum++;P->stack[P->top].ID = temp->ID;printf("\t\t\n\n车库有空位,请输入队列此车(车牌为:%d)当前入库时间:", temp->ID);scanf("%d", &_time);P->stack[P->top].arrivetime = _time;printf("\n\t此车已在队列中等待:%d time,现已进入车库!\n\n", _time - temp->arrivetime);//调整队头指针位置,并释放内存空间L->front->next = temp->next;if (L->rear == temp) L->rear = temp;//对于队列只剩一个数据时的队头调整free(temp);===========================================================================*///outqueue(ID, time, P, L);//库空填充函数(已弃)while (parkfull(P) == 0)//出库后再看有空位没有{//有空位就把等待队列的第一个放进来,且重新输入进入时间//出队操作int _time;qptr *temp;if (L->front == L->rear || L->front->next == NULL) return 0;//队列是空的,直接返回就好temp = L->front->next;P->stack[++P->top].num = internum++;P->stack[P->top].ID = temp->ID;printf("\t\t\n\n车库有空位,请输入队列此车(车牌为:%d)当前入库时间:", temp->ID);scanf("%d", &_time);P->stack[P->top].arrivetime = _time;printf("\n\t此车已在队列中等待:%d time,现已进入车库!\n\n", _time - temp->arrivetime);/*调整队头指针位置,并释放内存空间*/L->front->next = temp->next;if (L->rear == temp) L->rear = temp;//对于队列只剩一个数据时的队头调整outsidenum--;free(temp);}break;}}down--;//下个比较位置}return 2;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130

5、总览:


主函数main.c:

#include <stdio.h>
#include <stdlib.h>
#include "mainhead.h"
main()
{system("color 70");char arr;char arrtemp;int ID,timee;carpark *P;//停车场carqueue *L;//路边/**************初始化**************/L= initqueue();P = initstack();/**************初始化**************//*欢迎信息*/printf("\n\n");printf("\t--------        欢迎使用停车场管理系统       ---------\n");printf("\t--------Welcome to parking management system!---------\n");printf("\n\n");do{printf("格式:入库/出库(A/D),车牌,入库时间/出库时间\t输入T退出,输C查看当前状态!\n请输入:");scanf("%c,%d,%d", &arr, &ID, &timee);if (arr == 'A' || arr == 'D'){carinter(arr, ID, timee, P, L);arrtemp = getchar();fflush(stdin);}else if (arr == 'T'){exit(0);}else  if (arr == 'C'){arrtemp = getchar();fflush(stdin);printf("\n\n库内有:%d,库外等待车辆为:%d\n\n", P->top + 1, check());}else{system("cls");printf("\n\n程序错误的读取了一个字符,导致不能运行,请重新启动!\n\n");system("pause");}} while (arr!='\n');system("cls");printf("\n\n程序错误的读取了一个字符,导致不能运行,请重新启动!\n\n");system("pause");/*2017年4月1日00:02:56bug report有bug产生,导致错误输出循环输出了3遍*//*2017年4月2日14:27:27bugscanf那里会不明误读,暂时没有解决方案,后序再改*//*carinter('A', 1, 5, P, L);//上面车库已满,入库没问题,开始试库外队列carinter('A', 10, 5, P, L);carinter('D', 9, 20, P, L);system("pause");*/
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78

头文件mainhead.h:

#include <stdio.h>
#include <stdlib.h>
#define M 3//车库能停10辆
static int internum = 0;//总计进入车库的车数辆
static int outsidenum = 0;//总计还在外面的车辆数
//-----------------///--------------------///--------------------//
typedef struct {int num;int ID;int arrivetime;
}carinformation;
//定义停车场的结构体
typedef struct parkinglot {carinformation stack[M];int top;
}carpark;
//-----------------///--------------------///--------------------//
//--------------------///--------------------///--------------------//
typedef struct carnode {int num;int ID;int arrivetime;//struct node *next;
}qptr;
//定义外面狭长路的队列
typedef struct {qptr *front, *rear;
}carqueue;
//--------------------///--------------------///--------------------//carpark *initstack()
{carpark *T;T = (carpark *)malloc(sizeof(carpark));if (T == NULL){/*地址分配错误直接退出程序,不能继续了*/system("cls");printf("\n\n\t因为内存空间问题,导致程序出错!即将退出!\n\n");system("pause");exit(0);}T->top = -1;return T;
}
//初始化停车场
carqueue *initqueue()
{carqueue *L;L = (carqueue *)malloc(sizeof(carqueue));L->front = (carqueue *)malloc(sizeof(carqueue));if (L == NULL||L->front == NULL){/*地址分配错误直接退出程序,不能继续了*/system("cls");printf("\n\n\t因为内存空间问题,导致程序出错!即将退出!\n\n");system("pause");exit(0);}if (L->front == NULL);L->front->next = NULL;L->rear = L->front;return L;
}
//初始化路边停车位
int parkfull(carpark *P)
{if (P->top == M - 1)return 1;elsereturn 0;
}
//车满判断/*
下面是整个程序的核心内容
主要实现了进入车库和路边等待的调用
两个表的地址需要传过来
车库表和路边队列表;
carinter(char _array, int num, int time,carpark *P,carqueue *L)
carinter(进库还是出库char A/D ,车牌号int , 到达时间int ,carpark *P 车库表 ,carqueue *L 路边表)
*/
int carinter(char _array, int num, int time,carpark *P,carqueue *L)
{if (_array == 'A'){if (parkfull(P) == 1){int temp;//这里写车库满后进入队列的codeprintf("\t车牌为:%d的车辆,已进入路边等待!\n\n",num);temp = carroadsaid(time, num, L);if (temp == 0){/*地址分配错误直接退出程序,不能继续了*/system("cls");printf("\n\n\t因为内存空间问题,导致程序出错!即将退出!\n\n");system("pause");exit(0);}return 1;}else{int _top;printf("\t车牌为:%d的车辆,已进入车库!\n\n",num);_top = ++P->top;P->stack[_top].arrivetime = time;P->stack[_top].ID = num;P->stack[_top].num = internum++;return 1;}}else if (_array == 'D'){//这里是出库codeoutparking(num, time, P, L);return 2;//返回2,不清楚是否成功,只是返回一个数,错误在函数内判断}else//读取的char是个非法值,所以返回错误{return 0;}
}/*
路边等待队列分配
carroadsaid(int time, int ID, carqueue *L)
carroadsaid(时间, 车牌, carqueue *L 队列表)
*/
int carroadsaid(int time, int ID, carqueue *L)
{qptr *T;T = (qptr *)malloc(sizeof(qptr));if (T == NULL) return 0;//地址分配失败,返回失败T->num = outsidenum++;T->ID = ID;T->arrivetime = time;T->next = NULL;L->rear->next = T;L->rear = T;return 1;
}/*
这里是出库的核心函数
具体使用如下:
通过ID(车牌)寻找库内ID(车牌),如果不位于库顶(栈顶),就转移前方车辆至临时路边等待
出库后,计算停车时间,并将外面临时等待的车重新放入车库
如果入库后仍有空位,就将外面的等待队列添加进库,直到库满(栈满)
outparking(int ID, int time, carpark *P, carqueue *L)
outparking(车牌ID, 出库时间int , carpark *P 库表, carqueue *L 队列表)
*/
int outparking(int ID, int time, carpark *P, carqueue *L)
{int down = M-1;while (down >= 0){if (P->stack[down].ID == ID)//找到位置{if (down == P->top)//车在最外面{//这里是车在最外面的codeprintf("\t\n车牌为%d的,已出库!停车时间:%d,请按标准收费!\n\n", P->stack[down].ID, time - P->stack[down].arrivetime);P->stack[down].ID = P->stack[down].arrivetime = P->stack[down].num = -1;//清空位置--internum;//库内记数减一个--P->top;while (parkfull(P) == 0)//出库后再看有空位没有{//有空位就把等待队列的第一个放进来,且重新输入进入时间//出队操作int _time;qptr *temp;if (L->front == L->rear || L->front->next == NULL) return 0;//队列是空的,直接返回就好temp = L->front->next;P->stack[++P->top].num = internum++;P->stack[P->top].ID = temp->ID;printf("\t\t\n\n车库有空位,请输入队列此车(车牌为:%d)当前入库时间:", temp->ID);scanf("%d", &_time);P->stack[P->top].arrivetime = _time;printf("\n\t此车已在队列中等待:%d time,现已进入车库!\n\n", _time - temp->arrivetime);/*调整队头指针位置,并释放内存空间*/L->front->next = temp->next;if (L->rear == temp) L->rear = temp;//对于队列只剩一个数据时的队头调整outsidenum--;free(temp);}//outqueue(ID, time, P, L);//库空填充函数return 1;}else {//这里是车不在最外的code//down变量就是当前找到的位置,已经是数组了,不用减1carpark *temp;int x;temp = initstack();//初始化临时停车场P->top = down;//P表的top现在直接调整到找到元素那里for (x=M-1; x >down; x--){temp->stack[++temp->top].ID = P->stack[x].ID;temp->stack[temp->top].arrivetime = P->stack[x].arrivetime;temp->stack[temp->top].num = P->stack[x].num;}//往临时停车场停车printf("\t\n车牌为%d的,已出库!停车时间:%d,请按标准收费!\n\n", P->stack[down].ID, time - P->stack[down].arrivetime);//P->stack[down].ID = P->stack[down].arrivetime = P->stack[down].num = -1;//清空位置--internum;//库内记数减一个--P->top;//移动top指针while (temp->top >= 0){if (temp->stack[temp->top].num != -1) //判断是否已经取到原栈高度,也就是不用复制-1值过来,要不然top位置会错位{P->stack[++P->top].ID = temp->stack[temp->top].ID;P->stack[P->top].arrivetime = temp->stack[temp->top].arrivetime;P->stack[P->top].num = temp->stack[temp->top].num;temp->top--;//temp表top位置改变//P->top++;//P表top位置改变}else{break;//顶上是空不再复制过来}}//重新放回车库for (x = P->top+1; x < M; x++)P->stack[x].arrivetime = P->stack[x].ID = P->stack[x].num = -1;//向上清空车库/*这里应该还要判断车库有空位,所以放上面的代码过来要改成单独的函数,要不然太长了不具有独立性===========================================================================int _num, _time;qptr *temp;if (L->front == L->rear || L->front->next == NULL) return 0;//队列是空的,直接返回就好temp = L->front->next;P->stack[++P->top].num = internum++;P->stack[P->top].ID = temp->ID;printf("\t\t\n\n车库有空位,请输入队列此车(车牌为:%d)当前入库时间:", temp->ID);scanf("%d", &_time);P->stack[P->top].arrivetime = _time;printf("\n\t此车已在队列中等待:%d time,现已进入车库!\n\n", _time - temp->arrivetime);//调整队头指针位置,并释放内存空间L->front->next = temp->next;if (L->rear == temp) L->rear = temp;//对于队列只剩一个数据时的队头调整free(temp);===========================================================================*///outqueue(ID, time, P, L);//库空填充函数while (parkfull(P) == 0)//出库后再看有空位没有{//有空位就把等待队列的第一个放进来,且重新输入进入时间//出队操作int _time;qptr *temp;if (L->front == L->rear || L->front->next == NULL) return 0;//队列是空的,直接返回就好temp = L->front->next;P->stack[++P->top].num = internum++;P->stack[P->top].ID = temp->ID;printf("\t\t\n\n车库有空位,请输入队列此车(车牌为:%d)当前入库时间:", temp->ID);scanf("%d", &_time);P->stack[P->top].arrivetime = _time;printf("\n\t此车已在队列中等待:%d time,现已进入车库!\n\n", _time - temp->arrivetime);/*调整队头指针位置,并释放内存空间*/L->front->next = temp->next;if (L->rear == temp) L->rear = temp;//对于队列只剩一个数据时的队头调整outsidenum--;free(temp);}break;}}down--;//下个比较位置}return 2;
}
int check()//检查队列数量
{return outsidenum;
}

C语言停车场管理系统,使用栈和队列实现相关推荐

  1. Java停车场管理系统使用栈和队列任务台程序

    运行截图: (栈和队列) 点此去下载 在学习过程中,总结到的规律: 栈功能(仅有增删,无查改) • 入栈–增 • 出栈–删 队列功能(仅有增删,无查改) • 入队–增 • 出队–删 二者由于自身特性限 ...

  2. 数据结构课程设计----停车场管理系统(栈和队列)

    题目: 设停车场(如下图1所示)内只有一个可停放几量汽车的狭长通道,且只有一个大门可供汽车进出.汽车在停车场内按车辆到达时的先后顺序,依次由北向南排列(大门在最南端,最先到达的第一辆车停放在车场的最北 ...

  3. C语言停车场管理系统

    C语言停车场管理系统 [问题描述] 某停车场是一个可停放n辆汽车的狭长通道,且只有一个大门可供汽车进出.汽车在停车场内按车辆到达时间的先后顺序,依次由北向南排列(大门在最南端最先到达的第一辆车停放在车 ...

  4. 数据结构课设--2停车场管理(栈和队列的应用)

    2.停车场管理(栈和队列的应用) [问题描述] 设停车场是一个可以停放n辆汽车的狭长通道,且只有一个大门可供汽车进出.汽车在停车场内按车辆到达时间的先后顺序,依次有北向南排列(大门在最南端,最先到达的 ...

  5. c语言停车场管理系统实验报告,停车场实验报告..doc

    数据结构大作业 PAGE -3- <算法与数据结构>课程设计 题目:停车场的收费管理系统 组长:张赛 组员:王佳琪,袁洁莹,张瑜 完成日期:2013 设计目的与内容 问题描述 任务:停车场 ...

  6. C语言【数据结构】栈和队列【OJ题(C++)、选择题】

    目录 一.OJ题 1.225. 用队列实现栈 2.232. 用栈实现队列 3.622. 设计循环队列 4.20. 有效的括号 二.选择题 1.下列关于栈的叙述正确的是(B) 2.一个栈的入栈序列为AB ...

  7. C语言中堆、栈、队列

    C语言中堆.栈和队列: 1.堆和栈 (1)数据结构的堆和栈 堆栈是两种数据结构. 栈(栈像装数据的桶或箱子):是一种具有后进先出性质的数据结构,也就是说后存放的先取,先存放的后取.这就如同要取出放在箱 ...

  8. 停车管理系统汽车到达汽车离去c语言,停车场管理系统 C语言实现

    用堆栈模拟实际的停车场管理系统 一.问题描述 1.实验题目: 设停车场是一个可停放 n 辆汽车的狭长通道,且只有一个大门可供汽车进出.汽车在停车场内按车辆到达时间的先后顺序,依次由北向南排列(大门在最 ...

  9. c语言停车场的收费管理系统,c语言停车场管理系统

    #include #include #include #include #define max 3 #define price 1 int b=1; typedef struct { int day; ...

最新文章

  1. 【转】EventBus 3.0使用详解
  2. eclipse启动maven项目报类找不到
  3. atom和phpcs
  4. mysql读取sql脚本_Pandas直接读取sql脚本的方法
  5. 绝佳时机,前所未遇,开创全新购物体验
  6. 请教大家,如何使用sed命令,替换文件指定行的内容呢?-Linux系统管理-ChinaUnix.net...
  7. idea创建包怎么让包分层_干货 | 通勤包怎么选?我推荐这6只
  8. Intel Realsense D435 关于深度摄像头获取实际深度坐标时的常见问题及可能的解决方案
  9. PAT 乙级(Basic Level) 题解汇总(持续更新)(C++)
  10. ​Redis的各种“坑”,你知道多少?
  11. JavaScript高级程序设计之EventUtil
  12. .db怎么复制到java里_MongoDB如何复制collection里的数据到另一个collection方法总结...
  13. Apache 如何手动安装为服务并启动运行?
  14. AlphaGo真的赢了么?
  15. Atitit 各有所长原则 Thinker和Doer之争。 Doer Influencer relater thinker 目录 1. Doer Influencer relater thinke
  16. springmvc 使用Jackson的配置
  17. 大数据工程师简历怎么写,更受到HR青睐?
  18. tumblr_使用Tumblr创建美丽且易于更新的博客
  19. 201771010112罗松《面向对象程序设计(java)》第七周学习总结
  20. 光明勇士iOS服务器维护,裕际网络科技《光明勇士》3月11日 iOSamp;安卓部分区服数据互通公告 - 热门手游公告-TK游戏...

热门文章

  1. Vue 计算属性缓存和方法的区别:从另一段代码来看【vue3学习笔记】
  2. 转 嵌入式与UML建模 车载GPS
  3. [ESP32]学习笔记05
  4. LeetCode高频题:《逆水寒》在地图的制作中,美术在地图上刷一片连通区域,连通区域自动填充,请你判断给定几个点位置,他们是否属于被刷区域
  5. 浅析供应链金融及未来发展前景
  6. 后端开发——Flask框架从入门到入坟(中)
  7. 返利是怎么返的_天猫超市抢券攻略
  8. 南召第一高中高考成绩查询2021,南召县第一高级中学举行2021届高考百日冲刺誓师大会...
  9. 迅雷的工作原理 [揭密迅雷]
  10. 『每周译Go』那些年我使用Go语言犯的错