朋友们帮我查找错误,帮忙改正.
''酒店房间管理系统''
要求:客户自动入住 查询房间情况 查询客户入住情况 客人退房
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
/*定义客户结构体*/
struct guest
{char no[20];
char Name[20];
char sex[6];
};
/*声明客户数组及客户数量*/
struct guest guests[200];
char T[200]; /*房间没人住*/
int num=0;
int temp;
/*通过客户返回数组下标*/
int guest_SearchByIndex(char no[])
{int i;
for (i=0;i<200;i++)
{if (strcmp(guests[i].no,no)==0)
{return i;}
}
return -1;
}
/*通过姓名返回数组下标*/
int guest_SearchByName(char name[])
{int i;
for (i=0;i<200;i++)
{if (strcmp(guests[i].Name,name)==0)
{return i;}
}
return -1;
}
/*插入客户信息*/
void guest_Insert()
{int i;
for (i=0;i<200;i++)
{ if (T[i]=='0')
{printf("The room's number is d%\n",i);
printf("请输入姓名:");
scanf("%s",&guests[num].Name);
getchar();
printf("请输入性别:");
scanf("%s",&guests[num].sex);
getchar();
T[i]='1'; }
else
printf("The rooms are full");
break;}
}
/*显示单条客户记录*/
void guest_DisplaySingle(int index)
{
printf("%10s%10s%10s\n","房间编号","姓名","性别");
printf("-------------------------------------------------------------\n");
printf("%10s%10s%10s\n",guests[index].no,guests[index].Name,
guests[index].sex);
}
/*修改客户信息*/
void guest_Modify()
{
while(1)
{
char no[20];
char index;
int p;
printf("请输入要修改的客户的房号:");
scanf("%s",&no);
getchar();
index=guest_SearchByIndex(no);
if (index==-1)
{
printf("该客户不存在!\n");
}
else
{
printf("你要修改的客户信息为:\n");
guest_DisplaySingle(index);
printf("-- 请输入新值--\n");
printf("请输入房间编号:");
scanf("%s",&guests[index].no);
getchar();
{p=T[no];T[no]=T[index];T[index]=p;}
printf("请输入姓名:");
scanf("%s",&guests[index].Name);
getchar();
printf("请输入性别:");
scanf("%f",&guests[index].sex);
getchar();
}
printf("是否继续?(y/n)");
if (getchar()=='n')
{
break;
}
}
}
/*删除客户信息*/
void guest_Delete()
{
int i;
while(1)
{
char no[20];
int index;
printf("请输入要删除的客户房间编号:");
scanf("%s",&no);
getchar();
index=guest_SearchByIndex(no);
if (index==-1)
{
printf("该客户不存在!\n");
}
else
{
printf("你要删除的客户信息为:\n");
guest_DisplaySingle(index);
printf("是否真的要删除?(y/n)");
if (getchar()=='y')
{ T[num]=0;
for (i=index;i<num-1;i++)
{
guests[i]=guests[i+1];
}
num--;
}
getchar();
}
printf("是否继续?(y/n)");
if (getchar()=='n')
{
break;
}
}
}
/*按姓名查询*/
void guest_Select()
{
while(1)
{
char name[20];
int index;
printf("请输入要查询的客户的姓名:");
scanf("%s",&name);
getchar();
index=guest_SearchByName(name);
if (index==-1)
{
printf("该客户不存在!\n");
}
else
{
printf("你要查询的客户信息为:\n");
guest_DisplaySingle(index);
}
printf("是否继续?(y/n)");
if (getchar()=='n')
{
break;
}
}
}
/*显示客户信息*/
void guest_Display()
{
int i;
printf("%10s%10s%10s\n","房间编号","姓名","性别");
printf("-------------------------------------------------------------\n");
for (i=0;i<num;i++)
{
printf("%10s%10s10s\n",guests[i].no,guests[i].Name,guests[i].sex);
}
}
/*主程序*/
main()
{
char s[80];
int c;
int choice;
while(1)
{
/*主菜单*/
printf("\n*************** *酒店客户管理系统*******************\n");
printf(" 1. 增加客户记录 \n");
printf(" 2. 修改客户记录 \n");
printf(" 3. 删除客户记录 \n");
printf(" 4. 按姓名查询客户记录 \n");
printf(" 5. 输出所有客户记录 \n");
printf(" 6.退出 \n");
printf("******************************************************\n");
scanf("%d",&choice);
getchar();
switch(choice)
{
case 1:
guest_Insert();
break;
case 2:
guest_Modify();
break;
case 3:
guest_Delete();
break;
case 4:
guest_Select();
break;
case 5:
guest_Display();
break;
case 6:
exit();
break;
}
}
}
我的QQ是303523577,请
加Q发给我