资源简介
帮一个学弟写的小程序(c语言初学者可以看看有些bug):实现订房,查询,退房,评估业绩等诸多简单功能。
vc6.0编译通过~~~~~~~
代码片段和文件信息
////////////////////////////
//Hotel manager system
//Design by WongSwoon
//08.11.9
////////////////////////////
#include
#include
#include
//////////////////////////
struct Customer{
char name[10];
int id;
int tel;
int roomnum;
struct tm time;
}Customer[5][301];
//////////////////////////
struct Room{
int price;
int num;
int remain_num;
}room[5];
///////////////////////////
void InitRoom_Customer()
{
int ij;
room[1].price=2000;
room[1].num=room[1].remain_num=5;
room[2].price=1000;
room[2].num=room[2].remain_num=100;
room[3].price=700;
room[3].num=room[3].remain_num=300;
room[4].price=400;
room[4].num=room[4].remain_num=200;
for(i=1;i<=4;i++)
for(j=1;j<=room[i].num;j++)
{
strcpy(Customer[i][j].name“NULL“);
Customer[i][j].id=0;
Customer[i][j].tel=0;
Customer[i][j].roomnum=1000*i+j;
Customer[i][j].time.tm_mon=1;
Customer[i][j].time.tm_mday=1;
}
}
///////////////////////////////////
int Isempty(struct Customer c)
{
if(!strcmp(c.name“NULL“))
return 1;
else
return 0;
}
//////////////////////////////////
void OrderRoom(char c)
{
int in;
printf(“roomnumber\tname\tID\ttel-num\ttime\n“);
switch (c)
{
case ‘a‘:
{
if(room[1].remain_num==0)
printf(“Rooms has all been full of\n“);
for(i=1;i<=room[1].num;i++)
printf(“%d\t\t%s\t%d\t%d\t%d.%d\n“Customer[1][i].roomnumCustomer[1][i].name
Customer[1][i].idCustomer[1][i].telCustomer[1][i].time.tm_monCustomer[1][i].time.tm_mday);
printf(“Select the roomnumber and input the information:“);
scanf(“%d“&n);
for(i=1;i<=room[1].num;i++)
if(Customer[1][i].roomnum==n&&Isempty(Customer[1][i]))
break;
scanf(“%s%d%d%d.%d“Customer[1][i].name&Customer[1][i].id
&Customer[1][i].tel&Customer[1][i].time.tm_mon&Customer[1][i].time.tm_mday);
room[1].remain_num--;
}break;
case ‘b‘:
{
if(room[2].remain_num==0)
printf(“Rooms has all been full of\n“);
for(i=1;i<=room[2].num;i++)
printf(“%d\t\t%s\t%d\t%d\t%d.%d\n“Customer[2][i].roomnumCustomer[2][i].name
Customer[2][i].idCustomer[2][i].telCustomer[2][i].time.tm_monCustomer[2][i].time.tm_mday);
printf(“Select the roomnumber and input the information:“);
scanf(“%d“&n);
for(i=1;i<=room[2].num;i++)
if(Customer[2][i].roomnum==n&&Isempty(Customer[2][i]))
break;
scanf(“%s%d%d%d.%d“Customer[2][i].name&Customer[2][i].id
&Customer[2][i].tel&Customer[2][i].time.tm_mon&Customer[2][i].time.tm_mday);
room[2].remain_num--;
}break;
case ‘c‘:
{
if(room[3].remain_num==0)
printf(“Rooms has all been full of\n“);
for(i=1;i<=room[3].num;i++)
printf(“%d\t\t%s\t%d\t%d\t%d.%d\n“Customer[3][i].roomnumCustomer[3][i].name
Customer[3][i].idCustomer[3][i].telCustomer[3][i].time.tm_monCustomer[3][i].time.tm_mday);
- 上一篇:密码学快速取模指数算法C代码
- 下一篇:生产者消费者算法图形化演示系统
评论
共有 条评论