该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
/*有些地方太长了,折一下重新发**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#define MOST 500 //最大停车位
#define LEN sizeof(struct massage)
typedef char CHEPAI[20];
typedef struct massage
{
CHEPAI num;
int chewei;
long time;
struct massage * next;
}MASSAGE;
/****外部变量*****/
int n=0; //车辆数
int price=5; //每小时停车费
float value; //收费额
CHEPAI num; //车牌号
/*****************/
void input()
{
printf("\n请输入:车牌号:\n\n");
scanf("%s",num);
}
MASSAGE * newpart()
{
MASSAGE * p;
p=(MASSAGE *)malloc(LEN);
p->next=NULL;
return p;
}
MASSAGE * insert(MASSAGE * head)
{
long headtime;
MASSAGE * p,* p1,* p2;
p=newpart();
strcpy(p->num,num);
p1=head;
p2=p1->next;
if(n>=MOST)
{
printf("对不起,车位已满!\n");
getch();
return head;
}
time(&headtime);
while(p2!=NULL)
{
if((p2->chewei-p1->chewei)>1)
{
p1->next=p;
p->next=p2;
p->time=headtime;
printf("\n请停在%d号停车位,\
您的停车起始时间是:%s\n按任意键继续\n",\
p->chewei=p1->chewei+1,ctime(&headtime));
n++;
getch();
return head;