没有合适的资源?快使用搜索试试~ 我知道了~
设计一个停车场管理系统,模拟停车场的运作,通过此程序具备以下功能: 1、要求以栈模拟停车场,以队列模拟车场外的便道,按照从终端读入的输入数据序列进行模拟管理; 2、要求处理的数据元素包括三个数据项:汽车“到达”或“离去”信息、汽车牌照号码及到达或离去的时刻; 3、该系统完成以下功能:若是车辆到达,则输出汽车在停车场内或便道上的停车位置;若是车离去,则输出汽车在停车场内停留的时间和应交纳的费用(在便道上停留的时间不收费); 4、 要求栈以顺序结构实现,队列以链表实现。
资源推荐
资源详情
资源评论
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 20
#define price 0.05
typedef struct time{
int hour;
int min;
}Time;
typedef struct node{
char num[10];
Time reach;
Time leave;
}CarNode;
typedef struct NODE{
CarNode *stack[MAX+1];
int top;
}SeqStackCar;
typedef struct car{
CarNode *data;
struct car *next;
}QueueNode;
typedef struct Node{
QueueNode *head;
#include<stdlib.h>
#include<string.h>
#define MAX 20
#define price 0.05
typedef struct time{
int hour;
int min;
}Time;
typedef struct node{
char num[10];
Time reach;
Time leave;
}CarNode;
typedef struct NODE{
CarNode *stack[MAX+1];
int top;
}SeqStackCar;
typedef struct car{
CarNode *data;
struct car *next;
}QueueNode;
typedef struct Node{
QueueNode *head;
QueueNode *rear;
}LinkQueueCar;
void InitStack(SeqStackCar *);
int InitQueue(LinkQueueCar *);
int Arrival(SeqStackCar *,LinkQueueCar *);
void Leave(SeqStackCar *,SeqStackCar *,LinkQueueCar *);
void List(SeqStackCar,LinkQueueCar);
void main()
{
SeqStackCar Enter,Temp;
LinkQueueCar Wait;
int ch;
InitStack(&Enter);
InitStack(&Temp);
InitQueue(&Wait);
while(1)
{
printf("\n1. 车辆到达登记");
printf(" 2. 车辆离开登记");
printf(" 3. 车辆列表显示");
printf(" 4. 退出系统\n");
while(1)
{
scanf("%d",&ch);
if(ch>=1&&ch<=4)break;
else printf("\n请选择: 1~4.");
}
switch(ch)
}LinkQueueCar;
void InitStack(SeqStackCar *);
int InitQueue(LinkQueueCar *);
int Arrival(SeqStackCar *,LinkQueueCar *);
void Leave(SeqStackCar *,SeqStackCar *,LinkQueueCar *);
void List(SeqStackCar,LinkQueueCar);
void main()
{
SeqStackCar Enter,Temp;
LinkQueueCar Wait;
int ch;
InitStack(&Enter);
InitStack(&Temp);
InitQueue(&Wait);
while(1)
{
printf("\n1. 车辆到达登记");
printf(" 2. 车辆离开登记");
printf(" 3. 车辆列表显示");
printf(" 4. 退出系统\n");
while(1)
{
scanf("%d",&ch);
if(ch>=1&&ch<=4)break;
else printf("\n请选择: 1~4.");
}
switch(ch)
剩余7页未读,继续阅读
资源评论
whz_zb
- 粉丝: 269
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功