C语言编程酒店房价,C语言酒店入住管理系统课设(附源码).doc

PAGE

PAGE 1

C语言酒店入住管理系统课设

项目说明

本系统基于C语言开发,适用于刚入门的C语言新手项目课设,开发软件采用VC++6.0开发,VS,DEV C++等均可运行。(书生)

项目运行截图

代码界面截图

完整源码

#include

#include

#include

#include

#include

#define N 10

#define HOURROOM 10

#define NORMALROOM 288

#define BIGROOM 388

#define WORTHROOM 588

#define GREATROOM 998

struct room_message{

int number;//房间号

int people;//有无入住

int floor;//楼层数(不同楼层房间类型不同)

time_t time;//入住时间,无人住则置空

}ROOM[100];

struct administrator{

char name[16];

char password[16];

int number;

int age;

int sex;

}group[25];

int TheUsingAdministrator;

void BuildGroup(){ //建立密码文件

FILE *fp=NULL;

int a;

char b[16]={"0"};

if((fp=fopen("administrator.dat","r"))==NULL){ //创建文件,防止出错

fp=fopen("administrator.dat","w");

for(a=0;a<25;a++){

strcpy(group[a].name,b);

strcpy(group[a].password,b);

group[a].number=a+1;

group[a].sex=group[a].age=0;

fwrite(&group[a],sizeof(struct administrator),1,fp);

}

}

else{

for(a=0;a<25;a++){

fread(&group[a],sizeof(struct administrator),1,fp);

}

}

fclose(fp);

}

void BuildRoom(){ //创建(引用)房间的函数

FILE *fp=NULL;

int i,j;//控制循环

if((fp=fopen("roommessage.dat","r"))==NULL)

{

fp=fopen("roommessage.dat","w");

for(i=0;i

{

for(j=0;j

{

ROOM[i*10+j].number= j;

ROOM[i*10+j].floor= i;

ROOM[i*10+j].people= 0;

ROOM[i*10+j].time= 0;

fwrite(&ROOM[i*10+j],sizeof(struct room_message),1,fp);

}

}

}

else {

for(i=0;i

{

for(j=0;j

{

fread(&ROOM[i*10+j],sizeof(struct room_message),1,fp);

}

}

}

fclose(fp);

}

void PrintFee(int floor,int room,int fee,int people){ //打印所需费用

time_t time1,time2;

int a;

time1 = ROOM[floor*10+room].time;

time2 = time(NULL);

if(people==0){

printf("该房间没有人\n");

}

else {

if(floor<2){

a = ((time2-time1)/3600)+1;

printf("该房间的费用为%d元\n",a*fee);

}

else{

a=(((time2-time1)/3600)/24)+1;

printf("该房间的费用为%d元\n",a*fee);

}

}

}

v

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值