有大佬给看看吗?这个程序没有错误,但是不能运行

#include
#include
#include
#include
#include"windows.h"
//***********************************************************************************
int initial_room(); //初始化80个房间信息
int welcome(); //验证用户登陆,登陆成功显示欢迎信息
int enter();
int check_in();
int check_out();
int inquire();
int diancai1();
int i=0;
int caijia=0;
int pay=0;
typedef int ElemType;
//***********************************************************************************
struct Room
{
int number;
int rank;
int price;
int state;
};
struct Customer
{
char name[13],ID[19];
int room_number;
int pay;
int change;
int day;
char caiming;
int caijia;
};

int set_name(struct Customer *cs, char *n)
{
strcpy(cs->name,n);
return 14;
}
int set_ID(struct Customer *cs, char *p)
{
strcpy(cs->ID,p);
return 13;
}
int set_room_number(struct Customer *cs, int n)
{
cs->room_number=n;
return 12;
}
int set_day(struct Customer *cs, int d)
{
cs->day=d;
return 11;
}

char *get_name(struct Customer *cs)
{
return cs->name;
}
char *get_ID(struct Customer *cs)
{
return cs->ID;
}
int get_room_number(struct Customer *cs)
{
return cs->room_number;
}
int get_day(struct Customer *cs)
{
return cs->day;
}

//***********************************************************************************
struct Room room[60];
struct Customer customer[60];
//diancai
struct cai /*cai结构体 实现对菜品 已点份数、名称、原材料 的记录
/
{
int fenshu;
char name[50];
int use;
int price;
};
struct List /*该线性表实现对菜品原材料的剩余量的记录,线性表【i】对应菜品的点餐菜单编码*/
{

ElemType* list;
int size;
int MaxSize;
};
/*以下为线性表的函数*/
void InitList(struct List* L,int ms)

{
if(ms<=0){printf("ms 值非法!\n");exit(1);}
L->MaxSize=ms;
L->list=(int*)malloc(ms*sizeof(ElemType*));
if(!L->list)
{
printf("动态存储分配失败!");
exit(1);
}
L->size=0;
}
void againMalloc(struct List L)
{
ElemType *p=(int
)realloc(L->list,2*L->MaxSize*sizeof(ElemType));
if(!p){
printf("分配存储空间失败!");
exit(1);
}
L->list=p;
L->MaxSize=2*L->MaxSize;
}
void InsertLastList(struct List L,ElemType x)
{
if(L->size==L->MaxSize)
againMalloc(L);
L->list[L->size]=x;
L->size++;
}
/
表格函数*/
int cddayin(struct cai a[])
{
int i=0,j=0;
for(i=0;i {if(a[i].fenshu>0) j++;}
if(j!=0)
{
printf("已点菜/酒品编号 已点菜品名称 已点份数/瓶数 价格\n");
for(i=0;i if(a[i].fenshu>0)

{printf(" %5d %10s%14d %d¥ \n",i,a[i].name,a[i].fenshu,a[i].fenshu*a[i].price);
caijia=caijia+a[i].fenshu*a[i].price;
}
printf(" 您好,您点餐价格合计=%d¥\n",caijia);
}
return caijia;
if(j==0)
printf("顾客尚未点餐,无法进行菜单打印!\n");
}
void ycliao(struct List *yuan,struct cai a[])
{
int i=1,p=0,k=0,num;
for(i=0;i {
do{
p=a[i].use%100;
yuan->list[p]=yuan->list[p]-a[i].fenshu;
a[i].use=a[i].use/100;
}while(a[i].use!=0);
}
printf("请输入房间号:");
scanf("%d",&num);
if(num=101&&102&&103&&104&&105){
printf("|-------------------------------------------------------|--------------------|\n");
printf("|------------------原材料余量---------------------------|-----酒品余量-------|\n");
printf("|-------------------------------------------------------|--------------------|\n");
printf("| 10.鸡肉=%3d 11.猪肉=%3d 12.鱼肉=%3d | 50.雪花啤酒=%3d |\n",yuan->list[10],yuan->list[11],yuan->list[12],yuan->list[50]);
printf("| 13.黄瓜=%3d 14.土豆=%3d 15.豆腐=%3d | 51.燕京啤酒=%3d |\n",yuan->list[13],yuan->list[14],yuan->list[15],yuan->list[51]);
printf("| 16.茄子=%3d 17.青椒=%3d 18.牛肉=%3d | 52.二锅头=%3d |\n",yuan->list[16],yuan->list[17],yuan->list[18],yuan->list[52]);
printf("| 19.大葱=%3d 20.鲜鸭血=%3d 21.花生=%3d | |\n",yuan->list[19],yuan->list[20],yuan->list[21]);
printf("| 22.花椒=%3d 23.酱=%3d 24.胡萝卜=%3d | |\n",yuan->list[22],yuan->list[23],yuan->list[24]);
printf("| 25.辣椒=%3d 26.芹菜=%3d 27.豆皮=%3d | |\n",yuan->list[25],yuan->list[26],yuan->list[27]);
printf("|-------------------------------------------------------|--------------------|\n");
printf("|-------------------------------------------------------|--------------------|\n");
}}
void diancai(struct cai a[],struct Customer *cs )
{

int p=0,wep=0;
/*printf("请输入房间号\n");
scanf("%d",num);
for(i=0;i<60;i++)

if(cs->room[n].number==num)

/
do{
printf(" |----------------------------------------------|-------------------|\n");
printf(" |----------菜品(输入-1确认并结束点餐)----------|-------酒品--------|\n");
printf(" |----------------------------------------------|-------------------|\n");
printf(" | 1.红烧狮子头 2. 飘香桂鱼 3.京酱肉丝 21.长城干红 |\n");
printf(" | 4.爆炒竹鸡 5.水煮鱼 6.日本豆腐 | 22.喜力啤酒 |\n");
printf(" | 7.夫妻肺片 8.拍黄瓜 9.莲子羹 | 23.人头马 |\n");
printf(" |----------------------------------------------|-------------------|\n");
printf(" |----------------------------------------------|-------------------|\n");
scanf("%d",&p);
system("CLS");
if(p>=1&&p<=9)
{
printf(" |------------------------------------------|\n");
printf(" |------------------份数--------------------|\n");
printf(" |------------------------------------------|\n");
printf(" | 1.一份 2.两份 |\n");
printf(" | 3.三份 4.其他请直接输入 |\n");

printf(" |------------------------------------------|\n");
printf(" |------------------------------------------|\n");
scanf("%d",&wep);
if(wep>50)
{system("CLS");printf("您输入的值异常或过大,请您检查输入的值!\n");continue;}/
防止误输入*/
else if(wep<=50)
{a[p].fenshu+=wep;
system("CLS");
}
}
else if(p>=21&&p<=23)
{

    printf("           |--------------------------------------------------------|\n");
    printf("           |-------------------------酒品数量-----------------------|\n");
    printf("           |--------------------------------------------------------|\n");
    printf("           |    1.一瓶   2.两瓶  3.三瓶   4.其他瓶数请直接输入      |\n");   
    printf("           |--------------------------------------------------------|\n");
    printf("           |--------------------------------------------------------|\n");
    scanf("%d",&wep);
    if(wep>50)
    {system("CLS");printf("您输入的值异常或过大,请您检查输入的值!\n");continue;}/*防止误输入*/
    else if(wep<=50)
    {
        a[p].fenshu+=wep;
        system("CLS");
    }
}
else if(p!=-1)
    printf("对不起,你输入的编码没有对应菜品,请重新输入!\n");  
}while(p!=-1);

system("CLS");
cs->caijia=cddayin(a);

}

void ycldayin(struct List yuan,struct cai a[])
{
char l='\0';
printf("显示原材料余量?(Y/N)\n");
l=getch();
if(l=='Y'||l=='y')
{system("CLS");
ycliao(&yuan,a);}
else
{ system("CLS");
printf("\n\n\n\n");}
}
int diancai1(struct Customer cs)
{

int i=0;
char l='\0';
struct List yuan; /
yuan前不用加“*” /
struct cai a[60]={
{0,"\0",0},
{0,"宫爆鸡丁",10131421,15},{0,"飘香桂鱼",1124,14},{0,"京酱肉丝",112327,16},
{0,"爆炒竹鸡",141617,10},{0,"水煮鱼",122225,50},{0,"日本豆腐",152225,11},
{0,"夫妻肺片",18212625,17},{0,"拍黄瓜",13252223,8},{0,"莲子羹",20,20},
{0,"\0",0},{0,"\0",0},{0,"\0",0},
{0,"\0",0},{0,"\0",0},{0,"\0",0},
{0,"\0",0},{0,"\0",0},{0,"\0",0},
{0,"\0",0},{0,"\0",0},
{0,"长城干红",50,300},{0,"喜力啤酒",51,20},{0,"人头马",52,500},
{0,"\0",0},{0,"\0",0},{0,"\0",0},
{0,"\0",0},{0,"\0",0},{0,"\0",0}};
InitList(&yuan,60);
for(i=0;i<60;i++)
InsertLastList(&yuan,100);//+rand()%50
printf("\n\n\n\n\n\n\n\n");
printf(" |--------------------------------------------------------|\n");
printf(" |---------------- 欢迎您开始点餐! -----------------|\n");

printf(" |--------------- ----------------------------------------|\n");
Sleep(2500);
system("CLS");
diancai(a ,cs); /
点餐函数,开始点餐吧!*/
ycldayin(yuan,a);
printf("\n\n\n\n");
printf(" |--------------------------------------------------------|\n");
printf(" |-------------- 欢迎再次点餐,祝您用餐愉快! ---------------|\n");

printf(" |--------------------------------------------------------|\n");
printf("\n\n\n\n\n\n");
return 0;
}
int CCustomer(struct Customer cs)
{
printf("请您输入顾客的姓名\n");
scanf("%s",cs->name);
printf("请您输入顾客的身份证号码(18位数字)\n");
scanf("%s",cs->ID);
cs->pay = cs->change = cs->day = 0;
return 9;
}
int FCustomer()
{
printf("该顾客退房成功!");
return 8;
}
int main() //程序入口从这里开始运行
{
//system("color 3E");
char choice='1';
system("color 3E");
initial_room(); //初始化60个房间的信息,分三个等级
welcome(); //验证用户登陆,登陆成功显示欢迎信息
while(choice=='1')
{
enter(); //根据用户的选择执行不同的功能
printf("\n");
printf("继续使用本系统请按\"1\",退出请按\"2\"! ");
fflush(stdin);
scanf("%c",&choice);
printf("\n");
}
return 0;
}
//系统登陆界面
**********************************************************************
int welcome() //验证用户登陆,登陆成功显示欢迎信息
{
char name[10],code[20];
printf("请输入用户名和密码:\n");
printf("用户名:");
scanf("%s",name);
// scanf("%s%s",name,code);
printf("密码:");
scanf("%s",code);
while((strcmp(name,"Joe")!=0)||(strcmp(code,"Mercy")!=0))
{
printf("用户名或密码输入有误,请重新输入!\n");
scanf("%s%s",name,code);
}
printf("\n");
printf("\n");
printf(" ▲***************************▲\n");
printf(" △ 欢迎使用酒店管理系统! △\n");
printf(" ▲***************************▲\n");
printf("\n");
return 7;
}
//系统入口***************************************************************************
int enter()
{
int kind_of_service;
printf("请选择服务类别:入住、退房还是查询? \n");
printf("1->入住 2->退房 3->查询 4->点菜 ");
scanf("%d",&kind_of_service);
if((kind_of_service>4) || (kind_of_service<1))
{
printf("您的输入有误,请重试!\n");
scanf("%d",&kind_of_service);
}
else
{
switch(kind_of_service)
{

    case 1:
        check_in();
        break;
    case 2:
        check_out();
        break;
    case 3:
        inquire();
        break;
    case 4:
        diancai1();
        break;

    }
}
return 6;

}
//入住登记***************************************************************************
int check_in()
{
int pay;
{
int room_standard,day;
customer[i] = (struct Customer*)malloc(sizeof(struct Customer));
CCustomer(customer[i]);
printf("请您选择预定房间的标准:\n");
printf("1.单人间/天150元\n2.双人间/天200元\n3.标准间/天300元\n");
scanf("%d",&room_standard);
printf("请输入住宿天数\n");
scanf("%d",&day);
set_day(customer[i],day);
switch(room_standard)
{
int n;
case 1:
pay=day*150;
//set_pay(customer[i],pay);
printf("请收房费 %d元整!\n",pay);
for(n=0; n<20; n++)
{
if(room[n].state==0)
{
printf("入住房间号码为: %d\n",room[n].number);
room[n].state=2;
set_room_number(customer[i],room[n].number);
break;
}
}
break;
case 2:
pay=day*200;
printf("请收房费 %d元整!\n",pay);
for(n=20; n<40; n++)
{
if(room[n].state==0)
{
printf("入住房间号码为: %d\n",room[n].number);
room[n].state=2;
set_room_number(customer[i],room[n].number);
break;
}
}
break;
case 3:
pay=day*300;

        printf("请收房费 %d元整!\n",pay);
        for(n=40; n<60; n++)
        {
            if(room[n].state==0)
            {
                printf("入住房间号码为: %d\n",room[n].number);
                room[n].state=2;
                set_room_number(customer[i],room[n].number);
                break;
            }
        }
        break;
    }
    i++;
}
return 4;

}
//退房结算***************************************************************************
int check_out()
{
char name2[13],id2[19];
int standard,j,room_number,day1,day2,day;
printf("请输入要退房的顾客姓名和身份证号码:\n");
scanf("%s%s",name2,id2);
printf("请输入该顾客实住天数:\n");
scanf("%d",&day2);
for(j=0; j<i; j++)
{
if((strcmp(get_name(customer[j]),name2)==0)&&(strcmp(get_ID(customer[j]),id2)==0))
{
char account;
room_number=get_room_number(customer[j]);
standard=room_number/100;
day1=get_day(customer[j]);
day=day1-day2;

        switch(standard)
        {
        case 1:
            printf("顾客的房间号是%d :为单人间,每天150元\n",room_number);
            printf("实际住房消费 %d元整!\n",day2*150);
            printf("\n");
            if(day2*150+caijia<pay)
                printf("请退给该顾客 %d 元整!\n",day*150);
            if(day2*150+caijia>pay)
                printf("请补收该顾客住房费 %d 元整!\n",day2*150+caijia-pay);
                printf("用餐费用为:%d\n",caijia);
                printf("消费总钱数为%d\n",day2*150+caijia);
            break;
        case 2:
            printf("顾客的房间号是%d :为双人间,每天200元%d\n",room_number);
            printf("实际住房消费 %d元整!\n",day2*200);
            printf("\n");
             if(day2*200+caijia<pay)
                printf("请退给该顾客 %d 元整!\n",day*150);
            if(day2*200+caijia>pay)
                printf("请补收该顾客住房费 %d 元整!\n",day2*200+caijia-pay);
                printf("用餐费用为:%d\n",caijia);
                printf("消费总钱数为%d\n",day2*200+caijia);
            break;
        case 3:
            printf("顾客的房间号是%d :为标准间,每天300元%d\n");
            printf("实际住房消费 %d元整!\n",day2*300);
            printf("\n");
            if(day2*300+caijia<pay)
                printf("请退给该顾客 %d 元整!\n",day*300);
            if(day2*150+caijia>pay)
                printf("请补收该顾客住房费 %d 元整!\n",day2*300+caijia-pay);
            printf("用餐费用为:%d\n",caijia);
            printf("消费总钱数为%d\n",day2*300+caijia);
            break;

        }
        //printf("用餐费用为:%d\n",caijia);
        //printf("实际应收总价为")
        printf("退房核算清楚,请按1: ");
        fflush(stdin);
        scanf("%c",&account);
        if(account=='1')
        {
            int k;
            for(k=0; k<80; k++)
            {
                if(room[k].number==get_room_number(customer[j]))
                    room[k].state=0;
            }
            i--;
            for(; j<i; j++)
            {
                customer[j]=customer[j+1];
            }
            free(customer[i]);
            FCustomer();
        }
    }
}
return 3;

}
//信息查询***************************************************************************
int inquire()
{
char inquire_choice;
printf("房间信息查询请按1, 顾客信息查询请按2: ");
fflush(stdin);
scanf("%c",&inquire_choice);
if(inquire_choice=='1')
{
int j,k=0;
printf("\n");
printf("下列房间没人入住:\n");
for(j=0; j<60; j++)
{
if(room[j].state==0)
{
if(k%10==0)
printf("\n");
printf("%d\t",room[j].number);
k++;
}
}
printf("\n");
printf("\n");
k=0;

    printf("\n");
    printf("\n");
    printf("下列房间有人入住:\n");
    for(j=0; j<60; j++)
    {
        if(room[j].state==2)
        {
            if(k%10==0)
                printf("\n");
            printf("%d\t",room[j].number);
            k++;
        }
    }
    printf("\n");
    printf("\n");
}
else if(inquire_choice=='2')
{
    char inquire_choice;
    int j;
    printf("按姓名查询请按1, 按身份证查询请按2: \n");
    fflush(stdin);
    scanf("%c",&inquire_choice);
    if(inquire_choice=='1')
    {
        char name3[13];
        printf("请输入顾客的姓名: \n");
        scanf("%s",name3);
        for(j=0; j<i; j++)
        {
            if(strcmp(get_name(customer[j]),name3)==0)
            {
                printf("%s的住房信息如下:\n",name3);
                printf("\t房间号为: %d\n",get_room_number(customer[j]));
            }
        }
    }
    if(inquire_choice=='2')
    {
        char id3[19];
        int j;

        printf("请输入顾客的身份证: \n");
        scanf("%s",id3);
        for(j=0; j<i; j++)
        {
            if(strcmp(get_ID(customer[j]),id3)==0)
            {
                printf("%s的住房信息如下:\n",get_name(customer[j]));
                printf("\t房间号为: %d\n",get_room_number(customer[j]));

            }
        }
    }
}
return 2;

}
//房间信息初始化*********************************************************************
int initial_room() //对60个房间进行初始化,分3个等级
{
int j,k=101;
for(j=0; j<20; j++)
{
room[j].number=k++;
room[j].rank=1;
room[j].price=150;
room[j].state=0;
}
k=201;
for(j=20; j<40; j++)
{
room[j].number=k++;
room[j].rank=2;
room[j].price=200;
room[j].state=0;
}
k=301;
for(j=40; j<60; j++)
{
room[j].number=k++;
room[j].rank=3;
room[j].price=300;
room[j].state=0;
}
return 1;
}


Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问