Monday, September 29, 2014

Codes

#include<stdio.h>
#define PRICE 10
#define ENTTAX 1.06
#define SIZE 11
#define SIZETWO 21
#define SIZETHREE 31
#define SIZEFOUR 41
#define SIZEFIVE 51
void Home (void);
int Cinema (int);
int Movies ();
void Day ();
void Time ();
void Seat();
void Register();

int main ()
{
    int x,cinema_no,option;
    system("title SU2 CINEMA");
    Home();
    Register();
    if(option>1)
    {
    system("pause");
    system("cls");
    Home ();
    x=Cinema (cinema_no);
    system("pause");
    system("cls");
    Home ();
    Movies ();
    system("pause");
    system("cls");
    Home ();
    Day ();
    printf("\n");
    system("pause");
    system("cls");
    Home();
Time ();
system("pause");
system("cls");
Home();
Seat();
printf("\n\nYOUR TICKETS HAVE BEEN SUCCESSFULLY BOOKED. DO PAY AT OUR COUNTER BEFORE ENTERING THE CINEMA\n");
    printf("ENJOY THE MOVIE AND DO COME AGAIN!\n\nSU2COMPANY AND CO\n\n");
    }
    else if(option>2)
    {
    }  
    system("pause");
    return 0;
    
}
void Home (void)
{
    printf("\t\t ====   ===   ===   ====       ====   ========  ===   ===  ======  ===    ===    ==\n");
    system("color 0B");
    sleep(80);
    printf("\t\t======  ===   ===  ======     ======  ========  ===   ===  ======  ====  ====   ====\n");
    system("color 0C");
    sleep(80);
    printf("\t\t===     ===   ===     ===     ===       ====    ====  ===  ===     ===  = ===  ==  ==\n");
    system("color 0E");
    sleep(80);
    printf("\t\t=====   ===   ===   ===       ===       ====    === = ===  ======  ===    ===  ======\n");
    system("color 0A");
    sleep(80);
    printf("\t\t   ===  ===   ===  ===        ===       ====    ===  ====  ===     ===    ===  ==  ==\n");
    system("color 09");
    sleep(80);
    printf("\t\t======  ===   ===  ======     ======  ========  ===   ===  ======  ===    ===  ==  ==\n");
    system("color 0D");
    sleep(80);
    printf("\t\t ====     =====    ======      ====   ========  ===   ===  ======  ===    ===  ==  ==\n\n");
}
void Register()
{
    int option;
    printf("Sign Up (1) SignIn (2)\n");
scanf("%d",&option);
char name[20];
gets(name);
system("cls");
if(option == 1)
{
printf("--------------------------------------------------------------\n");
printf("\t\t\tSIGN UP\n");
printf("--------------------------------------------------------------\n");
char name[20];
int pw,age,phone;
printf("Fullname: ");
gets(name);
printf("Age: ");
scanf("%d",&age);
printf("Phone No: ");
scanf("%d",&phone);
    printf("Password: ");
scanf("%d",&pw);
printf("\nCONGRATULATION %s! You can now enjoy the movie with us!\n\n",name);
}
else if(option == 2)
{
printf("--------------------------------------------------------------\n");
printf("\t\t\tSIGN IN\n");
printf("--------------------------------------------------------------\n");
char name[20];
int pw;
printf("Fullname: ");
gets(name);
printf("Password: ");
scanf("%d",&pw);
printf("\n");
}
else if(option<1 || option>2)
{
    printf("--------------------------------------------------------------\n");
printf("\t\tSORRY, PLEASE TRY AGAIN\n");
printf("--------------------------------------------------------------\n");
}
return;
}
int Cinema (int x)
{
     
     int cinema_no;
     printf("\n\t\t\t\t\t\t  PLACE LIST\n\n\n");
     printf("\t\t\t\t(1) 1 Utama\t(2) Bukit Raja\t(3) Bukit Tinggi\n\n");
     printf("\t\t\t\t(4) Tebrau\t(5) Kinta City\t(6) Mesra Mall\n\n");
     printf("\t\t\t\t(7) Mines\t(8) Rawang\t(9) Seremban 9\n");
     printf("\n");
     printf("\t\t\t\t(10) Sunway Pyramid\t\t(11) Suria KLCC\n\n");
     printf("\t\t\t\t(12) Encorp Strand Mall\t\t(13) Wangsa Walk Mall\n");
     printf("\n");
     printf("\nSelect a Cinema(Enter the no): ");
     scanf("%d",&cinema_no);
     while (cinema_no<0 || cinema_no>13)
    {
          printf("\nThe number that you had enter is not in list!\n\n");
          printf("\nSelect a Cinema(Enter the no): ");
          scanf("%d",&cinema_no);
    }
     
     switch (cinema_no)
     {
            case 1: printf("\nYour choice is -1 Utama-\n\n");break;
            case 2: printf("\nYour choice is -Bukit Raja-\n\n");break;
            case 3: printf("\nYour choice is -Bukit Tinggi-\n\n");break;
            case 4: printf("\nYour choice is -Tebrau-\n\n");break;
            case 5: printf("\nYour choice is -Kinta City-\n\n");break;
            case 6: printf("\nYour choice is -Mesra Mall-\n\n");break;
            case 7: printf("\nYour choice is -Mines-\n\n");break;
            case 8: printf("\nYour choice is -Rawang-\n\n");break;
            case 9: printf("\nYour choice is -Seremban 9-\n\n");break;
            case 10: printf("\nYour choice is -Sunway Pyramid-\n\n");break;
            case 11: printf("\nYour choice is -Suria KLCC-\n\n");break;
            case 12: printf("\nYour choice is -Encorp Strand Mall-\n\n");break;
            case 13: printf("\nYour choice is -Wangsa Walk Mall-\n\n");break;
            default:break;
return x;
     }
}
int Movies ()
{
    int y;
    printf("\n\t\t\t\t\t\t\t MOVIE LIST \n\n\n");
    printf("\t\t(1)The Fault In Our Star\t(2)Guardian Of The Galaxy\t(3)The Maze Runner\t\n\n\t\t(4)A Walk Among The Tombstones");
    printf("\t(5)The Swimmers\t\t\t(6)Golden Brother\t\n\n\t\t(7)Nasi Tangas\t\t\t(8)The Purge Anarchy\t\t(9)Initial D Legend\n\n");
    printf("\t\t(10)Lagenda Budak Setan 3\t(11)Giver\t\t\t(12)Lucy\n\n\t\t(13)Gallows Hill\t\t(14)Fire&Rescue\t\t\t(15)The Signal\n\n\n");
    printf("Choose a movie (Enter the number): ");
    scanf("%d",&y);
    
    switch (y)
    {
            case 1: printf("\nYour choice is -The Fault In Our Star-\n\n");break;
            case 2: printf("\nYour choice is -Guardian Of The Galaxy-\n\n");break;
            case 3: printf("\nYour choice is -The Maze Runner-\n\n");break;
            case 4: printf("\nYour choice is -A Walk Among The Tombstones-\n\n");break;
            case 5: printf("\nYour choice is -The Swimmers-\n\n");break;
            case 6: printf("\nYour choice is -Golden Brother-\n\n");break;
            case 7: printf("\nYour choice is -Nasi Tangas-\n\n");break;
            case 8: printf("\nYour choice is -The Purge Anarchy-\n\n");break;
            case 9: printf("\nYour choice is -Initial D Legend-\n\n");break;
            case 10: printf("\nYour choice is -Lagenda Budak Setan 3-\n\n");break;
            case 11: printf("\nYour choice is -Giver-\n\n");break;
            case 12: printf("\nYour choice is -Lucy-\n\n");break;
            case 13: printf("\nYour choice is -Gallows Hill-\n\n");break;
            case 14: printf("\nYour choice is -Fire&Rescue-\n\n");break;
            case 15: printf("\nYour choice is -The Signal-\n\n");break;
            default: printf("Invalid!");break;
    }
    while (y<0 || y>15)
    {
          printf("\nThe number that you had enter is not in movie list!\n\n");
          printf("Choose a movies (Enter the number): ");
          scanf("%d",&y);
    }
        
          return;
}
void Day ()
{
     int day;
     printf("\n\t\t\t\t\t\t--CHOOSE DAY--\n\n");
     printf("\n\t\t\t*The day that you will choose only availabe for this week only*\n\n");
     printf("\t\t\t 1-Monday\t2-Tuesday\t3-Wednesday\t4-Thursday\t\n\n\t\t\t\t    5-Friday\t6-Saturday\t7-Sunday\n\n");
     printf("Day: ");
     scanf("%d",&day);
     while (day<0 || day>7)
            {
                  printf("\n\n\t\t-----------Sorry, Wrong input!-----------\n\n");
                  printf("Day: ");
                  scanf("%d",&day);
            }     
     switch (day)
     {
            case 1: printf("\nMonday\n");break;
            case 2: printf("\nTuesday\n");break;
            case 3: printf("\nWednesday\n");break;
            case 4: printf("\nThursday\n");break;
            case 5: printf("\nFriday\n");break;
            case 6: printf("\nSaturday\n");break;
            case 7: printf("\nSunday\n");break;
            default: break;
     }
     return;
}
void Time ()
{
     char time;
     printf("\nCHOOSE TIME\n\n\n");
     printf("\nPress:\n\n[A] 11.00 AM\n[B] 1.00 PM\n[C] 3.00 PM\n[D] 5.00 PM\n");
     printf("[E] 7.00 PM\n[F] 9.00 PM\n[G] 11.00 PM\n[H] 12.00 AM\n\n");
     printf("Enter time: ");
     scanf(" %c",&time);
     
     switch (time)
     {
            case 'a':
            case 'A': printf("\nTime: 11.00 AM\n\n");break;
            case 'b':
            case 'B': printf("\nTime: 1.00 PM\n\n");break;
            case 'c':
            case 'C': printf("\nTime: 3.00 PM\n\n");break;
            case 'd':
            case 'D': printf("\nTime: 5.00 PM\n\n");break;
            case 'e': 
            case 'E': printf("\nTime: 7.00 PM\n\n");break;
            case 'f': 
            case 'F': printf("\nTime: 9.00 PM\n\n");break;
            case 'g':
            case 'G': printf("\nTime: 11.00 PM\n\n");break;
            case 'h': 
            case 'H': printf("\nTime: 12.00 AM\n\n");break;
            default: printf("\nYou have put a wrong input, please try again!\n\n\n");break;
           
            return;
     }
}

void Seat()
{
    int i,ticket,x,price=10;
    float total=1;
    printf("\n\t\t\t\t*The Price Of The Ticket Per Seat is RM10*\n\t\t\t\t*Booking Fee is RM1*\n\n");
    printf("Ticket Quantity: ");
    scanf("%d",&ticket);
    total=((price*ticket)*ENTTAX)+1;
    printf("\n\nTOTAL RM%.2f\n\n",total);
    int seat[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50};
    
    
    printf(" (01) \t (02) \t (03) \t (04) \t (05) \t (06) \t (07) \t (08) \t (09) \t (10)\n");
    printf(" (11) \t (12) \t (13) \t (14) \t (15) \t (16) \t (17) \t (18) \t (19) \t (20)\n");
    printf(" (21) \t (22) \t (23) \t (24) \t (25) \t (26) \t (27) \t (28) \t (29) \t (30)\n");
    printf(" (31) \t (32) \t (33) \t (34) \t (35) \t (36) \t (37) \t (38) \t (39) \t (40)\n");
    printf(" (41) \t (42) \t (43) \t (44) \t (45) \t (46) \t (47) \t (48) \t (49) \t (50)\n");
    
    for(i=1;i<(ticket+1);i++)
    {
                       printf("\nEnter Seat %d: ",i);
                       scanf("%d",&x);
                       seat[x]=0;
    }                              
    
    printf("\n\n");
    for(x=1; x<SIZE;x++)
    {
             printf("%d\t",seat[x]);
             }
    printf("\n\n");
    for(x=11; x<SIZETWO;x++)
    {
              printf("%d\t",seat[x]);
              }
    printf("\n\n");
    for(x=21; x<SIZETHREE;x++)
    {
              printf("%d\t",seat[x]);
              }
    printf("\n\n");
    for(x=31; x<SIZEFOUR;x++)
    {
              printf("%d\t",seat[x]);
              }
    printf("\n\n");
    for(x=41; x<SIZEFIVE;x++)
    {
              printf("%d\t",seat[x]);
              }
    return;
}
www.tips-fb.com
Su2Cinema and Co

No comments:

Post a Comment