diff --git a/至查询入住情况.c b/至查询入住情况.c new file mode 100644 index 0000000..5cab2b2 --- /dev/null +++ b/至查询入住情况.c @@ -0,0 +1,191 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include //ʹҪõַڱļ +#include //exit()Ͱڴļ +#include +#define isPrime(year) ((year%4==0&&year%100!=0)||(year%400==0)) + +int z[100]={0}; +int s,j; +FILE *fp; + + +void check_in(); //Ǽס +void availability(); //ѯס +void fate_days(); //ѯס޵ķ +void fate_hours(); //ѯʱס޵ķ +void check_out_days(); //ס޵ķ +void check_out_hours(); //ʱס޵ķ +void modificate(); //޸Ϣ +void modificate_person(); //޸Ϣе޸ĿͻϢ +void modificate_accommodation(); //޸Ϣе޸סϢ +void save(); //溯 +void menu(); //˵ +void days(); //סΪ +void hours(); //סΪСʱ +int date1Diff(); // + + struct date1 +{ + int year; + int month; + int day; +}; + + +struct Date +{int year; +int month; +int day; +int hour; +int minute; +}date; //ڱ + +struct room +{ +int room_ID; // +int kind; //ࣨ˼䣬˫˼䣬˼䣬VIP׷ +char name[20]; //ͻ +int age; //ͻ +int sex; //ͻԱ +char ID_card[20]; //ͻ֤ +int day_money; //շѼ۸ +int hour_money; //СʱշѼ۸ +int count; // +struct Date date; +}room[100]; + + int main() + { + + printf("\n"); + menu(); //˵úʵ + save(); + return 0; +} + + + void menu() + { + int n; + do + { + printf("\n"); + printf(" \t ******************ӭסƵ***************** \n"); + printf("\n *********************˵********************"); + printf("\n******* 1.Ǽס \t *******\n"); + printf("******* 2.ѯס \t *******\n"); + printf("******* 3.ѯǰ() \t *******\n"); + printf("******* 4.ѯǰ(ʱ) \t *******\n"); + printf("******* 5.˵ǰ() \t *******\n"); + printf("******* 6.˵ǰ(ʱ) \t *******\n"); + printf("******* 7.˳ \t *******"); + printf(" *********************˵********************\n"); //˵棬òԱܹѡҪеIJ + printf("\nIJУϢһʱ0򷵻ز˵ѡ"); + printf("\nѡ:"); + scanf("%d",&n); + while(n<1||n>7) + {printf(" *********************롣********************\n"); + scanf("%d",&n);} + switch(n) + { + case 1:check_in();break; //õǼס + case 2:availability();break; //òѯס + case 3:fate_days();break; //òѯǰ÷ú + case 4:fate_hours();break; //òѯǰʱ÷ú + case 5:check_out_days();break; //ý÷ú + case 6:check_out_hours();break; //ý˵ǰʱ÷ú + case 7:exit(0); //˳ + } + }while(n!=7); +scanf("%d",&n); +} + +void check_in() // ǼǺ +{ + int op,way,po,i,num; + printf("Ҫķ"); + scanf("%d", &num); while(num<0||num>100) + {printf(" *********************롣********************\n"); + scanf("%d",&num);} + if(num==0) menu(); + for (i=1;i<=num;++i) { + printf("ǼϢ:\n"); + printf("\n%dţ(1ŵ100֮)",i); + scanf("%d", &j);if(j==0) menu(); + room[j].room_ID = j; + printf("\n:"); + scanf("%d", &room[j].age);if(room[j].age==0) menu(); + while (j<0||j>100) + { + printf(""); + } + printf("\nѡסʱͣ(1ʾƷѣ2ʾСʱƷ)\n\t *****ע⣺סʱϣѡƷ*****"); + scanf("%d", &way);if(way==0) menu(); + printf("\nסʱΪ():"); + scanf("%d", &room[j].date.year);if(room[j].date.year==0) menu(); + printf("\nסʱΪ():"); + scanf("%d", &room[j].date.month);if(room[j].date.month==0) menu(); + printf("\nסʱΪ():"); + scanf("%d", &room[j].date.day);if(room[j].date.day==0) menu(); + if (way == 1) + { + printf("\nࣺ[1˼(200Ԫ/)2˫˼(390Ԫ/)3˼(475Ԫ/)4VIP׷(650Ԫ/)]"); + scanf("%d", &op);if(op==0) menu(); + } + if (way == 2) + { + printf("\nࣺ[1˼(10Ԫ/Сʱ)2˫˼(19Ԫ/Сʱ)3˼(27Ԫ/Сʱ)4VIP׷(45Ԫ/Сʱ)]"); + scanf("%d", &po);if(po==0) menu(); + printf("\nסʱΪ(Сʱ):"); + scanf("%d", &room[j].date.hour);if(room[j].date.hour==0) menu(); + printf("\nסʱΪ():"); + scanf("%d", &room[j].date.minute);if(room[j].date.minute==0) menu(); + } + printf("\n"); + scanf("%s", &room[j].name);if(room[j].name==0) menu(); + printf("\nԱ(У1ʾУ2ʾŮ!):"); + scanf("%d", &room[j].sex);if(room[j].sex==0) menu(); + printf("\n֤ţ"); + scanf("%s", &room[j].ID_card);if(room[j].ID_card==0) menu(); + z[j] = 1; //ʹõķΪ1 + save(); + } + menu(); +} + + +void availability() //ѯס +{ + int g,count=0; + for(g=0;g<100;g++) +{ + if(z[g]==0) + ++count; + else + if(z[g]==1) + printf("\nʹõķ:%d",g); +} + printf("\n\nδʹõķ:%d",count); //ͨѭδʹõķ + printf("\n\n"); + printf("\nѯķ: "); //ѯķŵϢ÷Ϣ + scanf("%d",&s); + while(s<0||s>100) + {printf(" *********************롣********************\n"); + scanf("%d",&s);}if(s==0) menu(); + if(z[s]==1) + {printf(":%s",room[s].name); + printf("\nԱ(У1ʾУ2ʾŮ):%d",room[s].sex); + printf("\n:%d",room[s].age); + printf("\n֤:%s",room[s].ID_card); + printf("\n:%d",room[s].date.year); + printf(" :%d",room[s].date.month); + printf(" :%d",room[s].date.day); + printf("\n:%d",room[s].room_ID); + } + else + printf("÷δʹ!"); + menu(); + save(); //ñ溯 +} +