Home > Back-end >  Order form, just management system code, who can help change. Run wrong.
Order form, just management system code, who can help change. Run wrong.

Time:10-16


#include
#include//in use for the string is contained in this document
#include//the exit () function is included in this file
# define M 81
Int [81] z={0};//define an array to store use the tag information of the room, and initialized to 0
Int j, s;//define two global variable
FILE *fp;//defines a pointer to the file variable
Struct date
{int the month;
Int day;
Int year;
} final;


Struct hotel
{int price;
Int room_ID;
Struct client
{char name [20].
Int sex;
int age;
Char ID_card [20].
int count;
Struct the date start;
} the personal;
} room [M];//define global structure variables, and inside and call two structure

Int fflush (fp);//declare the refresh function fflush (fp), and point to a pointer variable pointing to the location of the
Void the save ();
Void search_situ ();//declare the function view room occupancy
Void regist_infor ();//declare the function room check-in
Void modify_infor ();//declare the function rooms information modify function
Void modify_one ();//declare revisions in the guest room information function to modify personal function
Void modify_hotel ();//declare modify room changes of information function room function
Void disp_money ();//declare the function display rooms


Int main ()
{
Int menu ();//declare the main menu function
Void print_star ();
Void print_message ();
Printf (" \ n \ n \ n \ n \ n ");
Print_star ();
printf("\n");
Print_message ();
printf("\n");
Print_star ();
The menu ();//the main use function to achieve
Save ();
return 0;
}


Void print_star ()
{int I;
for(i=1; I<30; I++)
Printf (" \ t * ");
}
Void print_message ()
{
Printf (" \ \ t \ \ t t t welcome the use of guest room management system management system \ n ");
}


The menu ()
{
int n;
Do
{
printf("\n");
Printf (" \ t \ t * * * * * * * * * * * * * * * * * * * * * menu * * * * * * * * * * * * * * * * * * * * \ n \ n \ n ");
Printf (" \ \ t \ \ t t t1: check the guest room occupancy \ n \ n \ n ");
Printf (" \ \ t \ \ t t t2: check-in information \ n \ n \ n ");
Printf (" \ \ t \ \ t t t3: modify the room information \ n \ n \ n ");
Printf (" \ \ t \ \ t t t4: show rooms \ n \ n \ n ");
Printf (" \ t t \ \ t \ t5: exit \ n \ n \ n ");
Printf (" \ \ t \ \ t t t6: return \ n \ n \ n ");
Printf (" \ t \ t * * * * * * * * * * * * * * * * * * * * * menu * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" \ n \ n \ t \ \ t t please select input options (1 \ \ 2 \ \ 3 \ \ 4 \ \ 5 \ \ 6] : \ n ");
The scanf (" % d ", & amp; N);
While (n<1 | | n> 6)
{printf (" please input options again!" );
The scanf (" % d ", & amp; N); }
The switch (n)
{
Case 1: search_situ (); break;//see the function called
Case 2: regist_infor (); break;//register function called
Case 3: modify_infor (); break;//modify function called
Case 4: disp_money (); break;//show rooms function called
Case 5: exit (0);
Case 6: break;
}
} while (n!=6);
The scanf (" % d ", & amp; N);
return 0;
}


Void search_situ ()//view function
{
Int g, count=0;
For (g=1; G<=80; G + +)
{
If [g] (z==0)
+ + count;
The else
If [g] (z==1)
Printf (" \ n are using room number: % d ", g);
}
Printf (" \ n \ n the unused room number: % d ", count);//the output circuit of unused room number
Printf (" \ n \ n ");
Printf (" \ n please enter to check out room number: \ n ");//room number information query input, and output information about the room
The scanf (" % d ", & amp; s);
If (z [s]==1)
Name: {printf (" % s ", room [s]. Personal. The name).
Printf (" \ n gender (including: 1 male, 2 said female!) : % d ", room [s]. Personal. The sex);
Printf (" \ n age: % d ", room [s]. Personal. The age);
Printf (" \ n id: % s ", room [s]. Personal ID_card);
Printf (" \ n in year: % d ", room [s]. Personal. The start. The year);
Printf (" month: % d ", room [s]. Personal. The start. The month).
Day: printf (" % d ", room [s]. Personal. The start. The day);
Printf (" \ n the room no. : % d ", room [s] room_ID);
Printf (" \ n the room price: % d ", room [s]. Price);
Printf (" \ n check-in number: % d ", room [s]. Personal. Count);
The menu ();
}
The else
Printf (" the room is not used!" );
Save ();//save the function called
}


Void regist_infor ()//registration function
{
Printf (" please enter the registration information: \ n ");
Printf (" \ n the room number: ");
The scanf (" % d ", & amp; J);
Room [j] room_ID=j;
Printf (" \ n the name: ");
The scanf (" % s ", & amp; Room [j]. The personal name);
Printf (" \ n gender (including: 1 male, 2 said female!) : ");
The scanf (" % d ", & amp; Room [j]. Personal. Sex);
Printf (" \ n age: ");
The scanf (" % d ", & amp; Room [j]. Personal. Age);
Printf (" \ n id number: ");
The scanf (" % s ", & amp; Room [j]. Personal ID_card);
Printf (" \ n check-in year: ");
The scanf (" % d ", & amp; Room [j]. Personal. Start. Year);
Printf (" : ");
The scanf (" % d ", & amp; Room [j]. Personal. The start. The month);
Printf (" : ");
The scanf (" % d ", & amp; Room [j]. Personal. Start. Day);
Printf (" \ n the room price: ");
The scanf (" % d ", & amp; Room [j]. Journal of price);
Printf (" please enter the number in the \ n ");
The scanf (" % d ", & amp; Room [j]. Personal. Count);
Z [j]=1;//tag to use room 1
Save ();
}


Void modify_infor ()//modify function
{
Int r, m;
Do
{
Printf (" \ t \ \ t t * * * * * * * * * * * * * * * * * * * menu * * * * * * * * * * * * * * * * * * \ n \ n \ n ");
Printf (" \ \ \ t \ \ t t t t 1: modify the customer information \ n \ n \ n ");
Printf (" \ \ \ t \ \ t t t t 2: modify the room information \ n \ n \ n ");
Printf (" \ \ \ t \ \ t t t t 3: menu () \ n \ n \ n ");
Printf (" \ t \ \ t \ \ t t t4: exit \ n \ n \ n ");
Printf (" \ t \ \ t t * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n \ n \ n ");
Printf (" \ t \ \ t t please select input options (1 \ \ 2 \ \ 3 \ \ 4] : \ n ");
The scanf (" % d ", & amp; M);
If (m<1 | | m> 3)
{
R=1; getchar();
}
The else r=0;
} while (r==1);
The switch (m)
{
Case 1: modify_one (); break;
Case 2: modify_hotel (); break;
Case 3: the menu ();
Case 4: exit (0);
}
Save ();
}


Void modify_one ()//modify personal information function
{
Int q;
Char a, [20]. nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related