当前位置:首页 » 编程语言 » 停车场收费c语言编程设计
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

停车场收费c语言编程设计

发布时间: 2022-09-05 17:39:20

‘壹’ 停车场收费程序设计

停车场收费的程序设计,可不是三言两语能说完的。
可以分人工自动两种吧。
全人工的比较简单,就是车进去记个时,离开的时候,再记个时,根据收费标准,删除该收多少费?人工收费。
程序设计,只需要维护一个数据库,里边有车牌号,开始时间,离开时间,根据车牌,检索调出相关信息就好。
如果自动收费,那就很复杂了。

‘贰’ 39、停车场管理c语言编程

程序太大 不让发 我是分几次发过去的 打三个出现乱码了 我在重新发一次

/*初始化停车场信息,初始状态为第一层已经停有4辆车,
* 其车位号依次为1—4 , 停车时间依次为20, 15, 10 , 5
*/
void Init(struct Garage gar[][6])
{
int i, j;

/*给所有的车位的层号,车位号初始化,停车时间初始化为0,停车位全都初始化为空*/
for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
gar[i][j].lay = i+1;
gar[i][j].garagenum = j+1;
gar[i][j].time = 0;
gar[i][j].isempty = 1;
}
}

/*第一层的1-4号车位停车*/
for (i=0; i<4; i++)
{
gar[0][i].isempty = 0;
}
strcpy(gar[0][0].carnum, "GF8888"); /*我自己初始化的车牌号,你可以自己改一下*/
gar[0][0].time = 20;
strcpy(gar[0][1].carnum, "GF6666");
gar[0][1].time = 15;
strcpy(gar[0][2].carnum, "GF9999");
gar[0][2].time = 10;
strcpy(gar[0][3].carnum, "GF5858");
gar[0][3].time = 5;
}

/*新停入的汽车后,将在此之前的所有车的停车时间加5*/
void AddTime(struct Garage gar[][6])
{
int i, j;
for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
if (gar[i][j].isempty == 0)
{
gar[i][j].time += 5;
}
}
}
}

/*停车*/
void Park(struct Garage gar[][6])
{
int i;
char num[8];

printf("请输入车牌号:");
scanf("%s", num);

/*查找空车位*/
for (i=0; i<6; i++)
{
if (gar[0][i].isempty == 1)
{
printf("第一层第%d号车位空着,请在此处停车\n", i+1);
strcpy(gar[0][i].carnum, num);
printf("车牌号:%s 层号:1 车位号: %d \n", num, i+1);
AddTime(gar); /*在此之前停车的所有汽车时间加5*/
gar[0][i].isempty = 0; /*表示该车为已经停车*/
gar[0][i].time = 5; /*将时间设为5*/

return;
}
}

printf("第一层已经没有空车位\n");

for (i=0; i<6; i++)
{
if (gar[1][i].isempty = 1)
{
printf("第二层第%d号车位空着,请在此处停车\n", i+1);
strcpy(gar[1][i].carnum, num);
printf("车牌号:%s 层号:2 车位号: %d \n", num, i+1);
AddTime(gar); /*在此之前停车的所有汽车时间加5*/
gar[1][i].isempty = 0; /*表示该车为已经停车*/
gar[1][i].time = 5; /*将时间设为5*/

return;
}
}

printf("对不起,1 2层都没有空车位,您现在不能在此停车\n");
}

/*查看所有车辆信息*/
void Information(struct Garage gar[][6])
{
int i, j;

printf(" 车牌号 层号 车位号 停车时间\n");

for (i=0; i<2; i++)
{
for(j=0; j<6; j++)
{
if (gar[i][j].isempty == 0)
printf(" %s%8d%8d%8d\n", gar[i][j].carnum, gar[i][j].lay, gar[i][j].garagenum, gar[i][j].time);
}
}

printf("\n");
}

/*取车*/
double Leave(struct Garage gar[2][6])
{
int i, j;
char num[8];
double charge = 0;

printf("请输入要取的车牌号:");
scanf("%s", num);

for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
if (!strcmp(gar[i][j].carnum, num))
{
printf("您在%d层%d车位停车%d分钟\n", gar[i][j].lay, gar[i][j].garagenum, gar[i][j].time);
charge = gar[i][j].time/5*0.2;
printf("停车费用为每5分钟0.2元,您需交%.2lf元\n", charge);
gar[i][j].isempty = 1;
return charge;
}
}
}

printf("没有您输入的车号。\n\n");
return charge;
}

/*是否查看总收入*/
void IsPrintTotal(double total)
{
char ch;
printf("是否查看停车收费总计?Y/N");
scanf("%c", &ch);
while (ch!='y' && ch!='Y' && ch!='n' && ch!='N')
{
printf("请输入Y或N ");
scanf("%c", &ch);
printf("\n");
}

switch (ch)
{
case 'Y':
case 'y':
printf("停车收费总计为%.2lf元\n", total);
break;
case 'N':
case 'n':
break;
}
}
main()
{
int choice;
double total = 0;
struct Garage gar[2][6];

Init(gar); //初始化第一层已经停有的4辆车

while (1)
{
Instruction();
printf("请输入要进行的操作:");
scanf("%d", &choice);
while (choice<0 || choice>3)
{
printf("输入的不合法,请输入0-3选择:");
scanf("%d", &choice);
}

switch (choice)
{
case 1:
Park(gar);
break;
case 2:
total += Leave(gar);
IsPrintTotal(total);
break;
case 3:
Information(gar);
break;
case 0:
exit(0);
}
}
return 0;
}

‘叁’ 用C语言编一个停车场管理系统

/*初始化停车场信息,初始状态为第一层已经停有4辆车,
* 其车位号依次为1—4 , 停车时间依次为20, 15, 10 , 5
*/
void Init(struct Garage gar[][6])
{
int i, j;

/*给所有的车位的层号,车位号初始化,停车时间初始化为0,停车位全都初始化为空*/
for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
gar[i][j].lay = i+1;
gar[i][j].garagenum = j+1;
gar[i][j].time = 0;
gar[i][j].isempty = 1;
}
}

/*第一层的1-4号车位停车*/
for (i=0; i<4; i++)
{
gar[0][i].isempty = 0;
}
strcpy(gar[0][0].carnum, "GF8888"); /*我自己初始化的车牌号,你可以自己改一下*/
gar[0][0].time = 20;
strcpy(gar[0][1].carnum, "GF6666");
gar[0][1].time = 15;
strcpy(gar[0][2].carnum, "GF9999");
gar[0][2].time = 10;
strcpy(gar[0][3].carnum, "GF5858");
gar[0][3].time = 5;
}

/*新停入的汽车后,将在此之前的所有车的停车时间加5*/
void AddTime(struct Garage gar[][6])
{
int i, j;
for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
if (gar[i][j].isempty == 0)
{
gar[i][j].time += 5;
}
}
}
}

/*停车*/
void Park(struct Garage gar[][6])
{
int i;
char num[8];

printf("请输入车牌号:");
scanf("%s", num);

/*查找空车位*/
for (i=0; i<6; i++)
{
if (gar[0][i].isempty == 1)
{
printf("第一层第%d号车位空着,请在此处停车\n", i+1);
strcpy(gar[0][i].carnum, num);
printf("车牌号:%s 层号:1 车位号: %d \n", num, i+1);
AddTime(gar); /*在此之前停车的所有汽车时间加5*/
gar[0][i].isempty = 0; /*表示该车为已经停车*/
gar[0][i].time = 5; /*将时间设为5*/

return;
}
}

printf("第一层已经没有空车位\n");

for (i=0; i<6; i++)
{
if (gar[1][i].isempty = 1)
{
printf("第二层第%d号车位空着,请在此处停车\n", i+1);
strcpy(gar[1][i].carnum, num);
printf("车牌号:%s 层号:2 车位号: %d \n", num, i+1);
AddTime(gar); /*在此之前停车的所有汽车时间加5*/
gar[1][i].isempty = 0; /*表示该车为已经停车*/
gar[1][i].time = 5; /*将时间设为5*/

return;
}
}

printf("对不起,1 2层都没有空车位,您现在不能在此停车\n");
}

/*查看所有车辆信息*/
void Information(struct Garage gar[][6])
{
int i, j;

printf(" 车牌号 层号 车位号 停车时间\n");

for (i=0; i<2; i++)
{
for(j=0; j<6; j++)
{
if (gar[i][j].isempty == 0)
printf(" %s%8d%8d%8d\n", gar[i][j].carnum, gar[i][j].lay, gar[i][j].garagenum, gar[i][j].time);
}
}

printf("\n");
}

/*取车*/
double Leave(struct Garage gar[2][6])
{
int i, j;
char num[8];
double charge = 0;

printf("请输入要取的车牌号:");
scanf("%s", num);

for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
if (!strcmp(gar[i][j].carnum, num))
{
printf("您在%d层%d车位停车%d分钟\n", gar[i][j].lay, gar[i][j].garagenum, gar[i][j].time);
charge = gar[i][j].time/5*0.2;
printf("停车费用为每5分钟0.2元,您需交%.2lf元\n", charge);
gar[i][j].isempty = 1;
return charge;
}
}
}

printf("没有您输入的车号。\n\n");
return charge;
}

/*是否查看总收入*/
void IsPrintTotal(double total)
{
char ch;
printf("是否查看停车收费总计?Y/N");
scanf("%c", &ch);
while (ch!='y' && ch!='Y' && ch!='n' && ch!='N')
{
printf("请输入Y或N ");
scanf("%c", &ch);
printf("\n");
}

switch (ch)
{
case 'Y':
case 'y':
printf("停车收费总计为%.2lf元\n", total);
break;
case 'N':
case 'n':
break;
}
}
main()
{
int choice;
double total = 0;
struct Garage gar[2][6];

Init(gar); //初始化第一层已经停有的4辆车

while (1)
{
Instruction();
printf("请输入要进行的操作:");
scanf("%d", &choice);
while (choice<0 || choice>3)
{
printf("输入的不合法,请输入0-3选择:");
scanf("%d", &choice);
}

switch (choice)
{
case 1:
Park(gar);
break;
case 2:
total += Leave(gar);
IsPrintTotal(total);
break;
case 3:
Information(gar);
break;
case 0:
exit(0);
}
}
return 0;
}

‘肆’ c语言停车场管理系统

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define max 3
#define price 1
int b=1;
typedef struct
{
int day;
int hour;
int min;
}TIME; //时间结点
typedef struct
{
char num[10]; //车牌号
TIME time; //进入停车场的时间
int n; //进入停车场的位置
}information;
//栈结构体定义
typedef struct node
{
information data;
struct node *next;
}stacknode; stacknode *top1,*top2;

//队列结构体定义
typedef struct
{
information data;
stacknode *front,*rear;
}LQueue;LQueue *Q;
//函数声明部分/////////////////////////////////////////////////////////

stacknode *Init(); //栈的初始化
stacknode *into(stacknode *top1,LQueue *Q); //初始化车辆进入
int expenses(stacknode *p,int x,int y); //停车费用计算函数
stacknode *leave(stacknode *top1,char str[],LQueue *Q); //车辆驶出出场函数
LQueue *InitLQue(); //初始化队列函数
LQueue *wait(LQueue *q,stacknode *s); //车辆进入候车便道函数
int EmptyLQue(LQueue *q); //判断候车便道有无等待车辆函数
stacknode *out(LQueue *q); //候车区车辆出队
stacknode *LQinto(stacknode *p,stacknode *top1); //从候车便道进入停车场函数
void show(stacknode *top1); //显示停车场所有信息函数
void T_shou(LQueue *Q); //显示候车区信息
/*函数部分*/
//主函数
void main()
{
char str[10];
Q=InitLQue();
top1=Init();
top2=Init();
Q=InitLQue();
int i;
printf("\t\t\t*************************************\n");
printf("\t\t\t\t 停车场管理系统\n");
printf("\t\t\t|| 1. 车辆进入停车场 ||\n");
printf("\t\t\t|| 2. 车辆离开停车场 ||\n");
printf("\t\t\t|| 3. 显示停车场内所有车辆信息 ||\n");
printf("\t\t\t|| 4. 显示候车区内所有车辆信息 ||\n");
printf("\t\t\t|| 5. 退出 ||\n");
printf("\t\t\t*************************************\n");
while(i!=5)
{
printf("\t请输入选项1-5:");
scanf("%d",&i);
switch(i)
{
case 1:
top1=into(top1,Q);
break;
case 2:
printf("请输入离开车辆的车牌号:");
scanf("%s",str);
top1=leave(top1,str,Q);
break;
case 3:show(top1);break;
case 4:T_shou(Q);break;
case 5:exit(1);
default:printf("输入错误,请重新输入1—5:");
break;
}

}
}
/*子函数*/
//初始化
stacknode *Init()
{
stacknode *top;
top=(stacknode *)malloc(sizeof(stacknode));
top=NULL;
return top;
}
//初始化车辆进入
stacknode *into(stacknode *top1,LQueue *Q)
{
stacknode *p,*q;
time_t rawtime; //调用系统时间函数
struct tm *timeinfo; //时间结点
time(&rawtime);
timeinfo=localtime(&rawtime);
p=(stacknode *)malloc(sizeof(stacknode));
if(p==NULL)
{
printf("内存分配失败");
return top1;
}
printf("请输入进入停车场车辆的车牌号:");
scanf("%s",p->data.num);
q=top1;
while(q!=NULL)
{
if(strcmp(p->data.num,q->data.num)==0)
{
printf("车牌号输入有误,该车已进入!");
return top1;
}
q=q->next;
}
p->data.time.day=timeinfo->tm_mday;
p->data.time.hour=timeinfo->tm_hour;
p->data.time.min=timeinfo->tm_min;
p->data.n=b;
if(b>max)
{
printf("停车场已满,请在便道等候!\n");
wait(Q,p);
return top1;
}
if(top1==NULL)
{
p->next=NULL;
top1=p;

}
else
{
p->next=top1;
top1=p;
}
b++;
printf("车辆进入停车场成功,时间已经自动载入!\n");
printf("车牌为%s的汽车驶入时间为:%d号%d点%d分\n",top1->data.num,top1->data.time.day,top1->data.time.hour,top1->data.time.min);
return top1;
}
//停车费用计算函数
int expenses(stacknode *p,int x1,int x2,int x3)
{
int w;
if(x3!=0)
w=(x1*24+x2+1-(p->data.time.day*24+p->data.time.hour))*price;
else
w=(x1*24+x2-(p->data.time.day*24+p->data.time.hour))*price;
return w;
}
//车辆驶出出场函数
stacknode *leave(stacknode *top1,char str[],LQueue *Q)
{
int i,day,hour,min;
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo=localtime(&rawtime);
day=timeinfo->tm_mday;
hour=timeinfo->tm_hour;
min=timeinfo->tm_min;
stacknode *p,*q;

if(top1==NULL)
{
printf("停车场没有车辆!\n");
return top1;
}
q=(stacknode *)malloc(sizeof(stacknode));
if(p==NULL)
{
printf("内存分配失败");
return top1;
}
q=top1;
while(q!=NULL)
{
if(strcmp(q->data.num,str)==0)
break;
q=q->next;
}

if(q==NULL)
{
printf("输入有误,该车辆不在停车场!\n");
return top1;
}

for(i=top1->data.n;i>q->data.n;i--)
{
p=(stacknode *)malloc(sizeof(stacknode));
if(p==NULL)
{
printf("内存分配失败");
return top1;
}
strcpy(p->data.num,top1->data.num);
p->data.time=top1->data.time;
p->data.n=top1->data.n-1;
top1=top1->next;
if(top2==NULL)
{
p->next=NULL;
top2=p;
}
else
{
p->next=top2;
top2=p;
}
}
top1=top1->next;
while(top2!=NULL)
{
p=(stacknode *)malloc(sizeof(stacknode));if(p==NULL){printf("内存分配失败");return top1;}
p->data.n=top2->data.n;
strcpy(p->data.num,top2->data.num);
p->data.time=top2->data.time;
p->next=top1;
top1=p;
top2=top2->next;
}

if(EmptyLQue(Q))
{
p=out(Q);
p->data.n--;
top1=LQinto(p,top1);
}
else
b--;
printf("车牌为%s的汽车驶出时间为:%d号%d点%d分\n",q->data.num,day,hour,min);
printf("车辆驶出停车场需要缴纳的费用为:%d元\n",expenses(q,day,hour,min));

return top1;
}
//队列函数初始化
LQueue *InitLQue()
{
LQueue *Q;
stacknode *p;
Q=(LQueue *)malloc(sizeof(LQueue));
p=(stacknode *)malloc(sizeof(stacknode));
p->next=NULL;
Q->front=Q->rear=p;
return Q;
}
//候车区队列入队
LQueue *wait(LQueue *q,stacknode *s)
{

s->next=NULL;
q->rear->next=s;
q->rear=s;
return q;

}
//判断候车便道有无车辆等待
int EmptyLQue(LQueue *q)
{
if(q->front==q->rear)
return 0;
else
return 1;
}
//候车区车辆出队
stacknode *out(LQueue *q)
{
stacknode *p;
p=q->front->next;
if(q->front->next==q->rear)
{
q->rear=q->front;
return p;
}
else
q->front->next=p->next;
p->next=NULL;
return p;
}
//候车队列进入停车场
stacknode *LQinto(stacknode *p,stacknode *top1)
{
p->next=top1;
top1=p;
return top1;
}
//显示停车场内所有车辆信息
void show(stacknode *top1)
{
printf(" 停车场内全部车辆信息表\n");
if(top1==NULL)
printf(" 停车场内无车!\n");

else
{
printf("车牌号 进入时间 位置\n");
while(top1!=NULL)
{
printf(" %s %d号%d点%d分 第%d位\n",top1->data.num,top1->data.time.day,top1->data.time.hour,top1->data.time.min,top1->data.n);
top1=top1->next;
}
}

}

//显示候车区的汽车信息
void T_shou(LQueue *Q)
{

LQueue *q;
q=(LQueue *)malloc(sizeof(LQueue));
q->rear=Q->rear->next;
printf(" 候车区信息\n");
if(q->front==q->rear)
printf("候车区没有车辆!\n");
else
{
printf("车牌号 进入时间\n");
while(q!=NULL)
{
printf("%s %d号%d点%d分",q->data.num,q->data.time.day,q->data.time.hour,q->data.time.min);
q->rear=q->rear->next;
}
}

}

/*时间函数

int timef()
{
int x,y;
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo=localtime(&rawtime);
x=timeinfo->tm_mday,y=timeinfo->tm_hour;
}

time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo=locoltime(&rawtime);
timeinfo->tm_ymday,*/

‘伍’ c语言-计算顾客泊车的费用(有点不同)

好了,我把它改成这样,你看成不!不行我再改!

#include<stdio.h>
double C(double a) //定义计算小轿车费用的函数
{
if(a<=3)return (0);
else return ((a-3)*1.5);
}
double B(double a) //定义计算巴士费用的函数
{
if(a<=1)return (a*2);
else return ((a-1)*3.7+2);
}
double T(double a) //定义计算货车费用的函数
{
if(a<=2)return (a*1);
else return ((a-2)*2.3+2);
}
void main()
{
int x1,y1,x2,y2,x,y;
double k=0,tz;
char z;
printf("车型?\n");
loop1:z=getchar();
getchar(); //消除回车符
if(z!='C'&&z!='B'&&z!='T')
{printf("您输入的车型不对,请重新输入\n");goto loop1;}
printf("进入停车场的小时数字(0—24)?\n");
scanf("%d",&x1);
printf("进入停车场的分钟数字(0—60)?\n");
scanf("%d",&y1);
printf("离开停车场的小时数字(0—24)?\n");
scanf("%d",&x2);
printf("离开停车场的分钟数字(0—60)?\n");
scanf("%d",&y2);
y=y2>y1?(y2-y1):(y2+60-y1);
x=y2>y1?(x2-x1):(x2-1-x1);
tz=y>0?(x+1):x;
printf ("停车收费\n车型: ");
switch (z)
{case 'C':k=C(tz);printf("小轿车\n");break;
case 'B':k=B(tz);printf("巴士\n");break;
case 'T':k=T(tz);printf("货车\n");break;
}
printf("进入时间%d: %d\n出去时间%d:%d\n-------\n停车时间%d小时%d分\n调整%.0lf小时\n-------\n一共 RMB %.2lf元",x1,y1,x2,y2,x,y,tz,k);

}

‘陆’ C语言 停车场记录停车时间与收费

printf("time is %f s\n",difftime(t_end,t_end));difftime中两个都是t_end,注定为0。

‘柒’ 用C语言编写“停车场管理系统”

程序太大 不让发 我是分几次发过去的 打三个出现乱码了 我在重新发一次

/*初始化停车场信息,初始状态为第一层已经停有4辆车,
* 其车位号依次为1—4 , 停车时间依次为20, 15, 10 , 5
*/
void Init(struct Garage gar[][6])
{
int i, j;

/*给所有的车位的层号,车位号初始化,停车时间初始化为0,停车位全都初始化为空*/
for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
gar[i][j].lay = i+1;
gar[i][j].garagenum = j+1;
gar[i][j].time = 0;
gar[i][j].isempty = 1;
}
}

/*第一层的1-4号车位停车*/
for (i=0; i<4; i++)
{
gar[0][i].isempty = 0;
}
strcpy(gar[0][0].carnum, "GF8888"); /*我自己初始化的车牌号,你可以自己改一下*/
gar[0][0].time = 20;
strcpy(gar[0][1].carnum, "GF6666");
gar[0][1].time = 15;
strcpy(gar[0][2].carnum, "GF9999");
gar[0][2].time = 10;
strcpy(gar[0][3].carnum, "GF5858");
gar[0][3].time = 5;
}

/*新停入的汽车后,将在此之前的所有车的停车时间加5*/
void AddTime(struct Garage gar[][6])
{
int i, j;
for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
if (gar[i][j].isempty == 0)
{
gar[i][j].time += 5;
}
}
}
}

/*停车*/
void Park(struct Garage gar[][6])
{
int i;
char num[8];

printf("请输入车牌号:");
scanf("%s", num);

/*查找空车位*/
for (i=0; i<6; i++)
{
if (gar[0][i].isempty == 1)
{
printf("第一层第%d号车位空着,请在此处停车\n", i+1);
strcpy(gar[0][i].carnum, num);
printf("车牌号:%s 层号:1 车位号: %d \n", num, i+1);
AddTime(gar); /*在此之前停车的所有汽车时间加5*/
gar[0][i].isempty = 0; /*表示该车为已经停车*/
gar[0][i].time = 5; /*将时间设为5*/

return;
}
}

printf("第一层已经没有空车位\n");

for (i=0; i<6; i++)
{
if (gar[1][i].isempty = 1)
{
printf("第二层第%d号车位空着,请在此处停车\n", i+1);
strcpy(gar[1][i].carnum, num);
printf("车牌号:%s 层号:2 车位号: %d \n", num, i+1);
AddTime(gar); /*在此之前停车的所有汽车时间加5*/
gar[1][i].isempty = 0; /*表示该车为已经停车*/
gar[1][i].time = 5; /*将时间设为5*/

return;
}
}

printf("对不起,1 2层都没有空车位,您现在不能在此停车\n");
}

/*查看所有车辆信息*/
void Information(struct Garage gar[][6])
{
int i, j;

printf(" 车牌号 层号 车位号 停车时间\n");

for (i=0; i<2; i++)
{
for(j=0; j<6; j++)
{
if (gar[i][j].isempty == 0)
printf(" %s%8d%8d%8d\n", gar[i][j].carnum, gar[i][j].lay, gar[i][j].garagenum, gar[i][j].time);
}
}

printf("\n");
}

/*取车*/
double Leave(struct Garage gar[2][6])
{
int i, j;
char num[8];
double charge = 0;

printf("请输入要取的车牌号:");
scanf("%s", num);

for (i=0; i<2; i++)
{
for (j=0; j<6; j++)
{
if (!strcmp(gar[i][j].carnum, num))
{
printf("您在%d层%d车位停车%d分钟\n", gar[i][j].lay, gar[i][j].garagenum, gar[i][j].time);
charge = gar[i][j].time/5*0.2;
printf("停车费用为每5分钟0.2元,您需交%.2lf元\n", charge);
gar[i][j].isempty = 1;
return charge;
}
}
}

printf("没有您输入的车号。\n\n");
return charge;
}

/*是否查看总收入*/
void IsPrintTotal(double total)
{
char ch;
printf("是否查看停车收费总计?Y/N");
scanf("%c", &ch);
while (ch!='y' && ch!='Y' && ch!='n' && ch!='N')
{
printf("请输入Y或N ");
scanf("%c", &ch);
printf("\n");
}

switch (ch)
{
case 'Y':
case 'y':
printf("停车收费总计为%.2lf元\n", total);
break;
case 'N':
case 'n':
break;
}
}
main()
{
int choice;
double total = 0;
struct Garage gar[2][6];

Init(gar); //初始化第一层已经停有的4辆车

while (1)
{
Instruction();
printf("请输入要进行的操作:");
scanf("%d", &choice);
while (choice<0 || choice>3)
{
printf("输入的不合法,请输入0-3选择:");
scanf("%d", &choice);
}

switch (choice)
{
case 1:
Park(gar);
break;
case 2:
total += Leave(gar);
IsPrintTotal(total);
break;
case 3:
Information(gar);
break;
case 0:
exit(0);
}
}
return 0;
}

‘捌’ 一个智能停车场,时间小于等于三小时收费两元,时间大于三小时收费十元。c++ 怎么编程

#include<iostream>
using namespace std;
int main()
{
float t,j;

cout<<"请输入停车小时数:";
cin>>t;
if(t<=3)
j=2;
else
j=10;
cout<<"收费"<<j<<"元"<<endl;
return 0;
}

‘玖’ 17.停车场管理系统设计: 求C语言大神帮助,发程序代码,好人全家平安

像这样的停车场管理系统,网上多的是,稍作修改就行了,在网上找了一个,发给你产考一下:

#include<stdio.h>
#include<string.h>
#define N 3 /*停车场大小*/
#define MAX 50 /*过道大小*/
#define sign 10/*车牌大小*/
#define price 10/*每分钟的价钱*/
char part[N][sign];
char Rpart[MAX][sign];
char time[N][20];
int P,R;
partadd(char *t)
{
strcpy(&part[P][0],t);
printf("请输入时间:例如十点十分格式为“10.10”\n");
scanf("%s",&time[P][0]);
getchar();
P++;
}
Rpartadd(char *t)
{
if(R<MAX)
{
strcpy(&Rpart[R][0],t);
R++;
}
else
{
printf("过道己满。无法停车。\n");
}
}
newcar()
{
char temp[sign];
printf("请输入车牌号:");
scanf("%s",temp);
getchar();
if(P<N)
{
partadd(temp);
}
else if(R<MAX)
{
Rpartadd(temp);
}
}
int timed(char *t1,char *t2)
{
int i=0,y=0,x=0,j,n=1;
while(1)
{
if(t1[i]=='.')
{
for(j=i-1;j>=0;j--)
{
y=y+(t1[j]-'0')*(60*n);
n=n*10;
}
while(1)
{
if(t1[j]==NULL)
{
for(n=1;j>i;j--)
{
y=y+(t1[j]-'0')*n;
n=n*10;
}
break;
}
j++;
}
i=0;
while(1)
{
if(t2[i]=='.')
{
for(j=i-1;j>=0;j--)
{
x=x+(t2[j]-'0')*(60*n);
n=n*10;
}
while(1)
{
if(t2[j]==NULL)
{
for(n=1;j>i;j--)
{
x=x+(t2[j]-'0')*n;
n=n*10;
}
break;
}
j++;
}
y=(x-y)*price;
return y;
}
i++;
}
}
i++;
}
}
partcarout(int i)
{
int j,money;
char t[20];
printf("请输入现在的时间:例如十点十分格式为“10.10”\n");
scanf("%s",t);
getchar();
money=timed(t,&time[i][0]);
printf("收费%d\n",money);
for(j=i;j<P;j++)
{
strcpy(&part[j][0],&part[j+1][0]);
P--;
}
if(R!=0)
{
strcpy(&part[N-1][0],&Rpart[0][0]);
P++;
strcpy(&time[P][0],t);
Rpartcarout(0);
}
}
Rpartcarout(int i)
{
int j;
for(j=i;j<R;j++)
{
strcpy(&Rpart[j][0],&Rpart[j+1][0]);
R--;
}
}
carout()
{
char t[sign];
int i,get=0;
printf("请入要离开的车牌号:");
scanf("%s",t);
getchar();
for(i=0;i<P;i++)
{
if(strcmp(t,&part[i][0])==0)
{
get=1;
partcarout(i);
break;
}
}
for(i=0;i<R&&get==0;i++)
{
if(strcmp(t,&Rpart[i][0])==0)
{
get=1;
Rpartcarout(i);
break;
}
}
if(get==0)
{
printf("查无此车。\n");
}
}
jopart()
{
int i;
for(i=0;i<P;i++)
{
printf("%d.%s\n",i,&part[i][0]);
}
}
joRpart()
{
int i;
for(i=0;i<R;i++)
{
printf("%d.%s\n",i,&Rpart[i][0]);
}
}
main()
{
int c;
while(1)
{
printf("请选择要做的事:\n");
printf("1.加入新车。\n");
printf("2.有车离开。\n");
printf("3.显示在停车场内的车。\n");
printf("4.显示在过道上的车。\n");
printf("5.退出。\n");
c=getchar();
getchar();
switch (c)
{
case '1':newcar();
break;
case '2':carout();
break;
case '3':jopart();
break;
case '4':joRpart();
break;
case '5':exit(1);
break;
}
}
}

‘拾’ c语言程序设计 停车场管理系统 停车场有1-20个车位号,设计一个停车场管理系统,实现停车场管理

你好!程序什么时间要呢?有关类似的,基本满足要求,你看看吧

可以按照你的要求修改源程序