C language realization of cinema seat selection management system

  • 2020-06-23 01:25:30
  • OfStack

This article shares the specific code of C language cinema seat selection management system for your reference. The specific content is as follows


/*
 write 1 Cinema seat selection management system procedures. 
 Problem description: 
 design 1 Cinema projection hall (volume is not less than 5 Row, each row not less than 10 People), 
 The function of seat selection for customers is realized through the "cinema seat selection management system". 
 Realize the following functions: 
1. The seat distribution graph is given. 
2. Can realize according to customer demand to choose seats; 
3. The system can automatically select seats for customers; 
4. The seat selector name can be found. 
 Specific requirements are as follows: 
1. Adopt multi - file structure design program; 
2. Seat distribution is given by characters or graphics, and seat selection can be viewed. 
3. Design the operation interface, which can be selected according to the seat designated by the customer or automatically selected by the system; 
4. Can display seat selector name information for a given seat. 
5. The ability to save seat information. 
*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
#define H 5
#define L 10
int a[H][L]={1,1,0,1,1,0,1,1,0,1,
    1,0,0,0,0,0,0,1,1,1,
    1,0,1,1,1,1,1,0,1,1,
    1,0,1,0,0,0,0,1,1,1,
    0,1,0,1,0,1,0,1,1,1};
// The custom 1 Dormancy function 
void Sleep(int millisecond)
{
 clock_t begin = clock();// Get the current CPU Clock time 
 while(clock() - begin < millisecond);// If the time difference does not meet the rest time requirements 1 Straight cycle 
}
 
int main()
{
 int i,j,count=0;
 int x,y;
 int choie;
 srand((unsigned)time(0));
 printf("\t\t Cinema Seating Chart: \n");
 for(i=0;i<H;i++)
 for(j=0;j<L;j++)
 {
 if(a[i][j])
 printf("  �  ");
 else 
 printf("  -  ");
 count++;
 if(count%10==0)
 printf("\n");
 }
 count=0;
 printf("\n Please select manual or system random ( 1 or 0 ) : \n 1. Manually choose \t 0. The system random \n");
 scanf("%d",&choie);
 if(choie){
printf("\n Please select your desired location ( x . y ) : ");
scanf("%d,%d",&x,&y);
 }
 else
 {
 for(i=0;i<H;i++)
 for(j=0;j<L;j++)
 if(!a[i][j]){
 x=i;y=j;
 }
 }
printf("/// The execution of ");
for(i = 0; i < 6; ++i)
 {
 Sleep(500);
 printf(".");
 }
 
system("cls");
 
// Change the position to 1
a[x-1][y-1]=1;
 printf("\t\t Cinema Seating Chart: \n");
for(i=0;i<H;i++)
for(j=0;j<L;j++)
{
 if(a[i][j])
 printf("  �  ");
 
else
 printf("  -  ");
 count++;
 if(count%10==0)
 printf("\n");
} 
printf(" Your position coordinates are ( %d . %d ) \n",x,y);
return 0;
 
}

For more information, please pay attention to the topic management System Development.


Related articles: