用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - c代码库

一个简单的客房管理系统

2016-07-29 作者: 梅西小王子举报

[c]代码库

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
 
 
struct Customer{
    char name[10];//顾客名字
    char ID[20];//顾客身份证;
    char sex[5];//性别
    int age;//年龄
    int state;//房型
    int room_number;//房号
    int in_data;//入住日期
    int out_data;//离店日期
    struct Customer *next;
 
};
typedef struct Customer * Pcustomer;
 
 
struct Room{
    int room_num;//房号
    int state;//房型
    int price;//价格
    int condition;//房间状态
    struct Room *next;
};
typedef struct Room *Proom;
 
void displayinformation(Pcustomer head) //显示顾客信息
{
    Pcustomer p;
    printf("\n姓名 性别  年龄  身份证    房型(1.单人间2.双人间3.通铺) 房号  入住日期   退房日期  \n");
    p=(Pcustomer)malloc(sizeof(struct Customer));
    p=head;
    if(head!=NULL)
    {
        while(p!=NULL)
        {
            printf("\n");
            printf("%-s\t%-s\t%-d\t%-s\t",p->name,p->sex,p->age,p->ID);
            printf("%-d\t%-d\t%-d\t%-d\t",p->state,p->room_number,p->in_data,p->out_data);
            p=p->next;
        }
    }
    else
        printf("无数据\n");
}
 
void print_room(Proom room)  //显示客房信息
{
    Proom p;
    printf("房号  房型  价格  是否为空房(1.yes 0.no)\n");
    p=(Proom)malloc(sizeof(struct Room));
    p=room;
    if(room!=NULL)
    {
        while(p!=NULL)
        {
            printf("%-d\t%-d\t%-d\t%-d\t\n",p->room_num,p->state,p->price,p->condition);
            p=p->next;
        }
    }
    else
        printf("无数据\n");
}
 
struct Customer *inputinformation(Pcustomer head) //顾客信息录入
{
    struct Customer *Insert(Pcustomer head,Pcustomer p);
    int n,i;
    Pcustomer p;
    p=(Pcustomer)malloc(sizeof(struct Customer));
    printf("\n请输入要录入顾客人数:");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        printf("\n请输入姓名:");
        scanf("%s",p->name);
        printf("\n请输入性别:");
        scanf("%s",p->sex);
        printf("\n请输入年龄:");
        scanf("%d",&p->age);
        printf("\n请输入身份证:");
        scanf("%s",p->ID);
        printf("\n请输入房型(1.单人间2.双人间3.通铺):");
        scanf("%d",&p->state);
        printf("\n请输入房号:");
        scanf("%d",&p->room_number);
        printf("\n请输入入住日期(如20160303):");
        scanf("%d",&p->in_data);
        printf("\n请输入退房日期(如20160303):");
        scanf("%d",&p->out_data);
 
        head=Insert(head,p);
        p=(Pcustomer)malloc(sizeof(struct Customer));
    }
 
    printf("\n您输入的顾客信息为:\n");
    displayinformation(head);
    return(head);
}

[源代码打包下载]




网友评论    (发表评论)

共1 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...