å¦ä½ç¨vbå个å车åºç®¡çç³»ç»
åºäºä½ çæè¿°å车åºç®¡çç³»ç»ï¼æ们å¯ä»¥ä¸ºä½ æä¾ä¸ä»½éç¨äºåå¦è ç代ç ,停车
å¦æå ·ä½éæ±ï¼å¯ä»¥æ们èç³»,,èç³»æ们éè¦æä¾ä½ çé®é¢åçµåé®ä»¶,æå¯è½å¸®ä½ ï¼ä½æ¯ç»å¯¹ææ¥,请ç¨BaiduHi为æçè¨,
æ¤åå¤é对æææ¥è®¿è åéæ±è ææ,
ES:\\7FB6FBECC7BBC8
Cè¯è¨å车åºç®¡çç³»ç»
/*----------------------------------------------------------------
// Copyright (C) æ²é³å·¥ç¨å¦é¢ä¿¡æ¯å®å ¨å·¥ä½å®¤
// çæææã
//
// æ件åï¼æ¨¡æå车åºé®é¢.cpp
// æ件åè½æè¿°ï¼æ¨¡æå车åºé®é¢
//
//
// å建æ è¯ï¼
//
// ä¿®æ¹æ è¯ï¼
// ä¿®æ¹æè¿°ï¼å®æç¼ç
//----------------------------------------------------------------*/
//头æ件
#include <iostream>
#include <malloc.h>
#include <string>
#include <windows.h>
//常éå®ä¹
#define MAX_STOP 4 //å®ä¹å车åºæ大å车æ°
#define MAX_PLATE //å®ä¹è½¦çå·æ大é¿åº¦
#define TIME_COUNT "ç§" //å®ä¹æ¶é´åä½
#define TIME_MS_TO_CONUT //å®ä¹æ¶é´è¿å¶ï¼æ为ç±TIME_COUNTå°æ¯«ç§çè¿å¶
#define UNIT_PRICE //å®ä¹åä½æ¶é´æ¶è´¹æ å
using namespace std; //使ç¨stdå½å空é´
//æ°æ®ç»æå®ä¹
//å®ä¹åå¨æ±½è½¦ä¿¡æ¯çç»æä½
typedef struct
{
char license_plate[MAX_PLATE]; //汽车çç §å·ç ï¼å®ä¹ä¸ºä¸ä¸ªå符æéç±»å
char state; //汽车å½åç¶æï¼å符p表示åæ¾å¨å车ä½ä¸ï¼å符s表示åæ¾å¨ä¾¿éä¸ï¼æ¯è¾è½¦çåå§ç¶æç¨å符iæ¥è¿è¡è¡¨ç¤º
int time; //汽车åå ¥å车åºæ¶çæ¶é´ï¼ç¨æ¥è®¡æ¶æ¶è´¹
}CAR;
//å®ä¹æ¨¡æå车åºçæ ç»æ
typedef struct
{
CAR STOP[MAX_STOP]; //汽车信æ¯çåå¨ç©ºé´
int top; //ç¨æ¥æ示æ 顶ä½ç½®çéææé
}SeqStack;
//å®ä¹æ¨¡æ便éçéåç»æ
typedef struct node
{
CAR WAIT; //汽车信æ¯çåå¨ç©ºé´
struct node *next; //ç¨æ¥æ示éåä½ç½®çå¨ææé
}QNode; //é¾éåèç¹çç±»å
//å®ä¹é¾éåçæ¶å°¾æé
typedef struct
{
QNode *front,*rear;
}LQueue; //å°å¤´å°¾æéå°è£ å¨ä¸èµ·çé¾é
//å½æ°å£°æ
int Empty_LQueue(LQueue *q); //å¤é空
int LeaveCheck(SeqStack parking , char *license_plate); //æ£æ¥ç¦»å¼ç车æ¯å¦å¨å车åºä¸
int QueueLength(LQueue *q); //å¤éé¿åº¦
int Out_LQueue(LQueue *&sidewalk , char *license_plate); //åºéæä½
int StackEmpty(SeqStack parking); //å¤ææ æ¯å¦ä¸ºç©º
int StackFull(SeqStack parking); //å¤ææ æ¯å¦ä¸ºæ»¡
int StackPop(SeqStack &parking); //åºæ æä½
int StackTop(SeqStack parking , char *license_plate , int &time);//åæ 顶å ç´
void Car_come(SeqStack &parking , LQueue *&sidewalk); //æ车å°æ¥æ¶çæä½
void Car_leave(SeqStack &parking , LQueue *&sidewalk); //æ车离å¼çæä½
void Display(SeqStack parking); //æ¾ç¤ºå车åºå çææä¿¡æ¯ è°è¯æ¶ç¨
void InitStack(SeqStack &parking); //åå§åæ
void InitList(LQueue *&sidewalk); //åå§åéå
void In_LQueue(LQueue *&sidewalk , char *license_plate); //è¿éæä½
void Input_Check(char *license_plate); ////æ£éªè¾å ¥ç车çæ¯å¦åæ³
void StackPush(SeqStack &parking , char *license_plate , int stop_time);//è¿æ æä½
void main()
{
//å®ä¹åé
SeqStack parking;
LQueue *sidewalk = NULL;
char *choice = new char;
int flag = 1; //å®ä¹ä¸ä¸ªåé å¤ææ¯å¦éåº
//åå§åä¸ä¸ªä¸ºç©ºçå车åº
InitStack(parking);
//åå§åä¸ä¸ªä¸ºç©ºç便é
InitList(sidewalk);
//è¿è¡çé¢ååè½éæ©
while(flag)
{
cout<<"\n\t å车åºæ¨¡æ管çç³»ç» \n\n";
cout<<"\t|--------------------------------------------------|\n\n";
cout<<"\t|æ¬ç¨åºä¸ºå车åºç模æ管çç³»ç»ï¼æ车å°æ¥æ¶è¯·æCé®ã|\n\n";
cout<<"\t|ç¶åæ ¹æ®å±å¹æ示è¿è¡ç¸å ³æä½ï¼æ车è¦èµ°æ¶è¯·ælé®ã|\n\n";
cout<<"\t|ç¶åæ ¹æ®å±å¹æ示è¿è¡ç¸å ³æä½ï¼æ¥çå车åºè¯·æDé®ã|\n\n";
cout<<"\t|ç¶åæ ¹æ®å±å¹æ示è¿è¡ç¸å ³æä½ï¼è¦éåºç³»ç»è¯·æQé®ã|\n\n";
cout<<"\t|--------------------------------------------------|\n\n";
cout<<"请éæ©æä½ï¼";
gets(choice);
if(1 != strlen(choice))
{
cout<<"请æ£ç¡®è¾å ¥é项!";
continue;
}
else
{
switch(*choice)
{
case 'c':
case 'C':
{
Car_come(parking,sidewalk);break;
}
case 'l':
case 'L':
{
Car_leave(parking,sidewalk);break;
}
case 'q':
case 'Q':
{
flag=0;break;
}
case 'd':
case 'D':
{
Display(parking);break;
}
default:
cout<<"éæ©ä¸æ£ç¡®ï¼è¯·éæ°éæ©ï¼\n";
}
}
}
}
//æ车å°æ¥æ¶çæä½
void Car_come(SeqStack &parking , LQueue *&sidewalk)
{
//å®ä¹åé
char license_plate[MAX_PLATE];
cout<<"请è¾å ¥è½¦è¾ç车çå·ç ï¼";
Input_Check(license_plate);
//å¤æå车åºæ¯å¦å·²æ»¡ï¼æ»¡åè¿å ¥ä¾¿éï¼ä¸æ»¡è¿å ¥å车åº
if(StackFull(parking))
{
In_LQueue(sidewalk , license_plate); //è¿å ¥ä¾¿é
cout<<"å车åºå·²æ»¡è¯·å¨ä¾¿éçå,æ¨çä½ç½®ä¸º"<<QueueLength(sidewalk)
<<endl;
}
else
{
StackPush(parking , license_plate , GetTickCount()); //è¿å ¥å车åº
cout<<"请è¿å ¥å车åºä¸ç"<<parking.top+1<<"å·å车ä½\n";
}
// Display(parking);
}
//æ车离å¼æ¶çæä½
void Car_leave(SeqStack &parking , LQueue *&sidewalk)
{
//å®ä¹åé
SeqStack tmpparking; //å®ä¹ä¸´æ¶å车åº
char leave_license_plate[MAX_PLATE]; //è¦ç¦»å¼ç车çå·
char license_plate[MAX_PLATE]; //åæ¾ä»å车åºä¸è¯»åºæ¥ç车çä¿¡æ¯
int time;
InitStack(tmpparking); //åå§å临æ¶å车åº
//å¤æå车åºä¸æ¯å¦æ车
if(StackEmpty(parking))
{
cout<<"å½åå车åºä¸æ²¡æ车\n";
return; //éåºåå½æ°
}
cout<<"请è¾å ¥è¦ç¦»å¼ç车çç §ï¼";
Input_Check(leave_license_plate);
cout<<"å½åå车åºä¸æ"<<parking.top+1<<"è¾è½¦\n";
if(LeaveCheck(parking , leave_license_plate)) //å¤æ车æ¯å¦å¨å车åºä¸
{
//车å¨å车åºä¸
cout<<"æ¨ç车å¨"<<LeaveCheck(parking , leave_license_plate)<<"å·è½¦ä½ä¸\n";
while(StackTop(parking , license_plate , time)
&& (strcmp(parking.STOP[parking.top].license_plate , leave_license_plate) != 0))
{
strcpy(parking.STOP[parking.top].license_plate , license_plate);
cout<<"çç §ä¸º"<<license_plate<<"ç车ææ¶éåºå车åº"<<parking.top+1<<"å·ä½\n";
StackPush(tmpparking , license_plate , time); //å车åºä¸ç车ææ¶éåº è¿å ¥ä¸´æ¶å车åº
StackPop(parking); //åºæ
}
cout<<"çç §ä¸º"<<license_plate<<"ç车离å¼å车åº"<<parking.top+1<<"å·ä½\n";
cout<<"æ¨å¨å车åºä¸åäº"<<(GetTickCount()-time)/TIME_MS_TO_CONUT<<TIME_COUNT<<endl; //è¾åºæåæ¶é´ä¿¡æ¯
cout<<"åºç¼´è´¹ç¨ä¸º"<<(GetTickCount()-time)/TIME_MS_TO_CONUT*UNIT_PRICE<<"å \n";; //è¾åºè´¹ç¨ä¿¡æ¯
StackPop(parking); //åºæ
//å°ä¸´æ¶å车åºä¸ç车ååå车åº
while(StackEmpty(tmpparking) != 1)
{
StackTop(tmpparking , license_plate , time);
StackPush(parking , license_plate , time);
cout<<"çç §ä¸º"<<license_plate<<"ç车è¿å ¥å车åº"<<parking.top+1<<"å·ä½\n";
license_plate[0] = '\0';
StackPop(tmpparking);
}
if(parking.top+1 == MAX_STOP-1) //å¤æ车离å¼åå车åºæ¯å¦å满
if(QueueLength(sidewalk)) //å¦æå满åå¤æ便éä¸æ¯å¦æ车
{
//便éä¸æ车 åä»ä¾¿éä¸åå ¥å车åº
Out_LQueue(sidewalk , license_plate); //åºé
StackPush(parking , license_plate , GetTickCount()); //å ¥æ
cout<<"å¨ä¾¿éä¸çç §ä¸º"<<license_plate<<"ç车è¿å ¥å车åº"<<parking.top+1<<"å·ä½\n";
}
}
else
//车ä¸å¨å车åºä¸
cout<<"æ¨ç车ä¸å¨å车åºä¸ï¼\n";
}
//åå§å顺åºæ
void InitStack(SeqStack &parking)
{
parking.top = -1;
}
//å¤æ 空
int StackEmpty(SeqStack parking)
{
if(parking.top == -1)
return 1;
else
return 0;
}
//å¤æ 满
int StackFull(SeqStack parking)
{
if(parking.top == MAX_STOP-1)
return 1;
else
return 0;
}
//å ¥æ
void StackPush(SeqStack &parking , char *license_plate , int stop_time)
{
parking.top++;
strcpy(parking.STOP[parking.top].license_plate , license_plate);
parking.STOP[parking.top].state = 'p';
parking.STOP[parking.top].time = stop_time;
}
//åºæ è¿åæ 顶æé
int StackPop(SeqStack &parking)
{
if(StackEmpty(parking))
return 0;
else
return parking.top--;
}
//åæ 顶å ç´
int StackTop(SeqStack parking , char *license_plate , int &time)
{
if(StackEmpty(parking))
return 0;
else
{
strcpy(license_plate , parking.STOP[parking.top].license_plate);
time = parking.STOP[parking.top].time;
return 1;
}
}
//æ¾ç¤ºææ
void Display(SeqStack parking)
{
if(parking.top == -1)
printf("å车åºä¸ºç©º\n");
else
{
while(parking.top != -1)
{
cout<<"车çå·ä¸ºï¼"<<parking.STOP[parking.top].license_plate;
cout<<"ï¼åå¨"<<parking.top + 1 <<"å·è½¦ä½ä¸";
cout<<"ï¼å·²å"<<(GetTickCount()-parking.STOP[parking.top].time)/TIME_MS_TO_CONUT<<TIME_COUNT<<endl;
parking.top--;
}
}
}
//åå§åéå
void InitList(LQueue *&sidewalk)
{
sidewalk = (LQueue *)malloc(sizeof(LQueue));
sidewalk->front=sidewalk->rear = NULL;
}
//å ¥é
void In_LQueue(LQueue *&sidewalk,char *license_plate)
{
QNode *car_on_sidewalk;
car_on_sidewalk = (QNode *)malloc(sizeof(QNode)); //为æ°èç¹å¼è¾æ°ç©ºé´
strcpy(car_on_sidewalk->WAIT.license_plate , license_plate); //å°æ°æ®åå ¥èç¹
car_on_sidewalk->WAIT.state = 's'; //åå ¥å车信æ¯
car_on_sidewalk->WAIT.time = GetTickCount(); //åå ¥å车æ¶é´
car_on_sidewalk->next = NULL;
if(Empty_LQueue(sidewalk)) //é空åå建第ä¸ä¸ªèç¹
sidewalk->front = sidewalk->rear = car_on_sidewalk;
else
{
//éé空æå ¥éå°¾
sidewalk->rear->next = car_on_sidewalk;
sidewalk->rear = car_on_sidewalk;
}
}
//å¤é空
int Empty_LQueue(LQueue *q)
{
if(q->front == NULL)
return 1;
else
return 0;
}
//å¤éé¿åº¦ è¿åéé¿
int QueueLength(LQueue *q)
{
QNode *p=q->front;
int i=0;
while(p != NULL)
{
i++;
p=p->next;
}
return i;
}
//åºé æåè¿å1 é空è¿å0
int Out_LQueue(LQueue *&sidewalk,char *license_plate)
{
QNode *car_on_sidewalk;
if(Empty_LQueue(sidewalk)) //å¦æé空è¿å0
return 0;
car_on_sidewalk = sidewalk->front;
strcpy(license_plate , car_on_sidewalk->WAIT.license_plate);//ååºé头å ç´
if(sidewalk->front == sidewalk->rear) //éä¸åªæä¸ä¸ªå ç´
sidewalk->front = sidewalk->rear=NULL; //å é¤å ç´
else
sidewalk->front = sidewalk->front->next; //é头æéå移
free(car_on_sidewalk); //éæ¾æé
return 1;
}
//æ£æ¥ç¦»å¼ç车æ¯å¦å¨å车åºä¸ è¿å车å¨å车åºä¸ä½ç½® ä¸å¨åè¿å0
int LeaveCheck(SeqStack parking,char *license_plate)
{
int flag = parking.top+1; //å®ä¹åéè®°å½å½å车å¨å车åºä¸ä½ç½®
if(StackEmpty(parking))
return 0;
else
{
//æ¥æ¾ç¦»å¼è½¦æå¨ä½ç½®
while(parking.top != -1 && strcmp(parking.STOP[parking.top].license_plate , license_plate) != 0)
{
flag--;
parking.top--;
}
return flag;
}
}
//æ£éªè¾å ¥ç车çæ¯å¦åæ³
void Input_Check(char *license_plate)
{
int flag = 1;
int i;
string tmpstr;
while(flag)
{
cin>>tmpstr;
getchar();
if(tmpstr.length()<MAX_PLATE)
{
for(i=0;i<;i++)
license_plate[i] = tmpstr.c_str()[i];
flag = 0;
}
else
cout<<"è¾å ¥æ误ï¼è¯·éæ°è¾å ¥ï¼";
}
}
以åç课设 ä½ ççå§ çº¯æå·¥ç~~
智慧停车方案+源码
城市级智慧停车项目 YunParking 全面开源,提供多种功能,场管车场包括路内停车、理源路外室内停车、码停共享车位、管理车位预约、源码html5 特效 源码室内导航、停车反向巡车、场管车场收费规则、理源支付聚合、码停设备管理、管理巡查PAD执法、源码车位推荐查找、停车Qt投票系统源码会员充值、场管车场等级管理、理源月卡充值、月卡支付、余额支付、区层管理、weblogic部署java源码车主管理、车场管理、第三方云存储、短信等,功能和完整度极高。系统具备路内停车、2019推广赚钱源码路外停车、停车诱导的统一管理功能,支持完整的路内停车管理与路外停车管理,并对接停车诱导系统实现综合管理。财务模块实现费用清算与统计分析。业务运营服务体系包含运营概况、英文小说站源码客户服务、会员管理、车辆管理等。运维模块提供设备运行情况、故障信息、运维监控等功能。设置模块实现用户及权限管理,支持云坐席功能。车主APP、小程序、公众号提供停车电子支付、停车代缴、停车记录查询、附近停车场诱导等功能。手持管理PDA终端支持检测巡检与收费端应用。路内停车管理模式比选包括基于地磁+PDA采集、基于地磁+巡查车采集、基于地感采集、基于车位锁采集、基于高位视频采集、基于视频桩采集等方案,每种方案各有特点与适用场景。
2024-11-23 11:46
2024-11-23 11:37
2024-11-23 10:31
2024-11-23 10:19
2024-11-23 10:18