Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int dfunction(int room[100],int s);
- void funcheck();
- int main() {
- int room[101];
- char movie[50];
- int i,showdt,clobby,j,seatres,pos;
- int lobby = 1 + rand() % 20;
- printf("------------------------------------WELCOME-----------------------------------\n\n\n");
- printf(" Please Login\n");
- funcheck();
- printf("\nDOCTOR STRANGE\nHACKSAW RIDGE\nUNDERWORLD: BLOOD WARS\nPETE'S DRAGON");
- do
- {
- printf("\n\nWhich movie you want to see?(enter the first word of thr movie) :");
- scanf("%s",&movie);
- }while (((strcmp(movie, "DOCTOR")!=0)) && ((strcmp(movie, "HACKSAW")!=0)) && ((strcmp(movie, "UNDERWORLD")!=0)) && ((strcmp(movie, "PETE")!=0)));
- do{
- printf("\n\nGive the day you want to watch the movie :");
- scanf("%d",&showdt);
- }while (showdt>24);
- printf("\nThe available lobby for this movie is :%d",lobby);
- do
- {
- printf("\nPlease enter the number of the lobby that showed up for confirmation :");
- scanf("%d",&clobby);
- }while (clobby!=lobby);
- system("cls");
- printf("Here you can see the availability of the seats:\n\n\n");
- for(i=0;i<101;i++)
- {
- room[i]=i;
- }
- for(i=100;i>=0;i--)
- {
- if(room[i]<=100 && room[i]>=80)
- {
- printf("%d ",room[i]);
- }
- else if(room[i]==79)
- {
- printf("\n %d ",room[i]);
- }
- else if(room[i]<79 && room[i]>=65)
- {
- printf("%d ",room[i]);
- }
- else if(room[i]==64)
- {
- printf("\n %d ",room[i]);
- }
- else if(room[i]<64 && room[i]>=50)
- {
- printf("%d ",room[i]);
- }
- else if(room[i]==49)
- {
- printf("\n %d ",room[i]);
- }
- else if(room[i]<49 && room[i]>=35)
- {
- printf("%d ",room[i]);
- }
- else if(room[i]==34)
- {
- printf("\n %d ",room[i]);
- }
- else if(room[i]<35 && room[i]>=20)
- {
- printf("%d ",room[i]);
- }
- else if(room[i]==19)
- {
- printf("\n %d ",room[i]);
- }
- else if(room[i]<19 && room[i]>=10)
- {
- printf("%d ",room[i]);
- }
- else if(room[i]==9)
- {
- printf("\n %d ",room[i]);
- }
- else if(room[i]<9 && room[i]>=1)
- {
- printf("%d ",room[i]);
- }
- }
- do
- {
- printf("\n\nFor how many seats you want to make a reservaration? :");
- scanf("%d",&seatres);
- }while ((seatres!=1) && (seatres!=2));
- pos=dfunction(room,seatres);
- printf("\n\nseat(s) is :%d\n\n\n",pos);
- /*NEOS PINAKAS*/
- for(i=100;i>=0;i--)
- {
- if(i<=100 && i>=80)
- {
- printf("%d ",room[i]);
- }
- else if(i==79)
- {
- printf("\n %d ",room[i]);
- }
- else if(i<79 && i>=65)
- {
- printf("%d ",room[i]);
- }
- else if(i==64)
- {
- printf("\n %d ",room[i]);
- }
- else if(i<64 && i>=50)
- {
- printf("%d ",room[i]);
- }
- else if(i==49)
- {
- printf("\n %d ",room[i]);
- }
- else if(i<49 && i>=35)
- {
- printf("%d ",room[i]);
- }
- else if(i==34)
- {
- printf("\n %d ",room[i]);
- }
- else if(i<35 && i>=20)
- {
- printf("%d ",room[i]);
- }
- else if(i==19)
- {
- printf("\n %d ",room[i]);
- }
- else if(i<19 && i>=10)
- {
- printf("%d ",room[i]);
- }
- else if(i==9)
- {
- printf("\n %d ",room[i]);
- }
- else if(i<9 && i>=1)
- {
- printf("%d ",room[i]);
- }
- }
- return 0;
- }
- void funcheck()
- {
- char name[50];
- char pass[50];
- int f;
- f=0;
- while (f!=1)
- {
- if (((strcmp(name, "movie")==0) && (strcmp(pass, "mo")==0)))
- {
- f=1;
- }
- else
- {
- printf("Username :");
- scanf("%s",&name);
- printf("Password :");
- scanf("%s",&pass);
- }
- }
- }
- int dfunction(int room[101],int s)
- {
- int seatnum,seatnum2,mid,mid2;
- int lk = 1 + rand() % 100;
- char chs[10];
- do{
- printf("\nIn which way you want to choose seats(Press 'X' for manual way or 'A' for automatic way) :");
- scanf("%s", &chs);
- }while ((strcmp(chs, "A")!=0) && (strcmp(chs, "X")!=0));
- if (strcmp(chs, "X")==0)
- {
- if(s==1)
- {
- printf("\n\nType the number of the seat(s) you want :");
- scanf("%d", &seatnum);
- room[seatnum]=0;
- }
- else if(s==2)
- {
- printf("\n\nType the number of the seat(s) you want :");
- printf("\nSeat number 1 :");
- scanf("%d", &seatnum);
- room[seatnum]=0;
- printf("\nSeat number 2 :");
- scanf("%d",&seatnum2);
- mid=seatnum+1;
- mid2=seatnum-1;
- if ((seatnum>=100 && seatnum<=81) || (seatnum>=79 && seatnum<=66) || (seatnum>=64 && seatnum<=51) || (seatnum>=49 && seatnum<=36) || (seatnum>=34 && seatnum<=21) || (seatnum>=19 && seatnum<=11) || (seatnum>=9 && seatnum<=2))
- {
- do
- {
- printf("\nSeat number 2 :");
- scanf("%d",&seatnum2);
- }while((seatnum2!=mid2) && (seatnum2!=mid));
- }
- else if ((seatnum==80) || (seatnum==65) || (seatnum==50) || (seatnum==35) || (seatnum==20) || (seatnum==10) || (seatnum==1))
- {
- do
- {
- printf("\nSeat number 2 :");
- scanf("%d",&seatnum2);
- }while (seatnum2!=mid);
- }
- else if ((seatnum==100) || (seatnum==79) || (seatnum==64) || (seatnum==49) || (seatnum==34) || (seatnum==19) || (seatnum==9))
- {
- do
- {
- printf("\nSeat number 2 :");
- scanf("%d",&seatnum2);
- }while (seatnum2!=mid2);
- }
- }
- room[seatnum2]=0;
- }
- else if(strcmp(chs, "A")==0)
- {
- if(s==1)
- {
- seatnum=lk;
- printf("\nSeat number :%d\n",seatnum);
- room[seatnum]=0;
- }
- else if(s==2)
- {
- seatnum=lk;
- printf("\nSeat number 1:%d",seatnum);
- room[seatnum]=0;
- if ((seatnum<=100 && seatnum>=81) || (seatnum<=79 && seatnum>=66) || (seatnum<=64 && seatnum>=51) || (seatnum<=49 && seatnum>=36) || (seatnum<=34 && seatnum>=21) || (seatnum<=19 && seatnum>=11) || (seatnum<=9 && seatnum>=2))
- {
- seatnum2=seatnum+1;
- printf("\nSeat number 2:%d",seatnum2);
- room[seatnum2]=0;
- }
- else if ((seatnum==80) || (seatnum==65) || (seatnum==50) || (seatnum==50) || (seatnum==35) || (seatnum==20) || (seatnum==10) || (seatnum==1))
- {
- seatnum2=seatnum-1;
- printf("\nSeat number 2:%d",seatnum2);
- room[seatnum]=0;
- }
- else if ((seatnum==100) || (seatnum==79) || (seatnum==64) || (seatnum==49) || (seatnum==34) || (seatnum==19) || (seatnum==9))
- {
- seatnum2=seatnum+1;
- printf("\nSeat number 2:%d",seatnum2);
- room[seatnum2]=0;
- }
- }
- }
- return seatnum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement