Advertisement
zaman360live

Project from Siam

Sep 26th, 2021
1,023
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.16 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <strings.h>
  4. void help();
  5. int choice1();
  6. int ticket2();
  7. void ticket3();
  8. int ticket4();
  9. void sitplan();
  10. char choice;
  11. char name[100];
  12. int age;
  13. int choice1()
  14. {
  15. mainhome:
  16.     system("cls");
  17.     printf("                 Train Ticket Booking System\n");
  18.     printf(" ==================================================================\n");
  19.     printf("||          Press T- To puchase ticket:                           ||\n");
  20.     printf("||          Press H- To goto Help Section:                        ||\n");
  21.     printf("||          Press E- Exit system:                                 ||\n");
  22.     printf("||================================================================||\n");
  23.     printf("  Press To Select: ");
  24.  
  25.     choice = toupper(getch());
  26.     if (choice == 'T')
  27.     {
  28.         ticket2();
  29.         goto mainhome;
  30.     }
  31.     else if (choice == 'H')
  32.     {
  33.         help();
  34.         goto mainhome;
  35.     }
  36.     else if (choice == 'E')
  37.         exit(1);
  38.     return choice1;
  39. }
  40. int main()
  41. {
  42.  
  43.     choice1();
  44.  
  45.     return 0;
  46. }
  47.  
  48. void sitplan()
  49. {
  50.     char love;
  51.     int fake;
  52.     system("cls");
  53.     printf("\t-----------------THEATER BOOKING TICKET----------------\n");
  54.     printf("\t============================================================\n");
  55.     printf("\t Booking ID : %d \t\tShow Name :Godholi Train\n", name);
  56.     printf("\t Customer  : %s   \t       Age:%d ", name, age);
  57.     printf("\t\t\t                       Date      : 5-07-2021\n");
  58.     printf("\t-----------------Available Sit----------------\n");
  59.     printf("\t============================================================\n");
  60.     if (choice == 'A')
  61.     {
  62.         love = choice;
  63.         goto time1;
  64.     }
  65.     else if (choice == 'B')
  66.     {
  67.         love = choice;
  68.         goto time2;
  69.     }
  70.     else if (choice == 'C')
  71.     {
  72.         love = choice;
  73.         goto time3;
  74.     }
  75.     else if (choice == 'D')
  76.     {
  77.         love = choice;
  78.         goto time4;
  79.     }
  80.  
  81. time1:
  82.     printf("\t Sit:- B1:B2  :  \t\tSit:- B3:B4\n");
  83.  
  84.     goto time5;
  85. time2:
  86.     printf("\t Sit:- C1:C2  :  \t\tSit:- C3:C4\n");
  87.     goto time5;
  88. time3:
  89.     printf("\t Sit:- D1:D2  :  \t\tSit:- D3:D4\n");
  90.     goto time5;
  91. time4:
  92.     printf("\t Sit:- E1:E2  :  \t\tSit:- E3:E4\n");
  93.     goto time5;
  94. time5:
  95.     printf("A for 1, B for 2, C for 3, D for 4");
  96.     if (choice == 'A')
  97.     {
  98.         fake = 1;
  99.         goto time6;
  100.     }
  101.     else if (choice == 'B')
  102.     {
  103.         fake = 2;
  104.         goto time6;
  105.     }
  106.     else if (choice == 'C')
  107.     {
  108.         fake = 3;
  109.         goto time6;
  110.     }
  111.     else if (choice == 'D')
  112.     {
  113.         fake = 4;
  114.         goto time6;
  115.     }
  116. time6:
  117.     printf("Press Enter to Confirm\n");
  118.     getch();
  119.     system("cls");
  120.     printf("Congratulation %s!!\nYour Booked Sit is %c%d \nYour Counter ID: %d", name, love + 1, fake, name);
  121.     printf("\n\n\n\nPress any key to Exit");
  122. }
  123.  
  124. int ticket2()
  125. {
  126.  
  127.     ticket3();
  128.     age = ticket4();
  129.     system("cls");
  130.     printf("\n\n");
  131.     printf("\t-----------------THEATER BOOKING TICKET----------------\n");
  132.     printf("\t============================================================\n");
  133.     printf("\t Booking ID : %d \t\tShow Name :Godholi Train\n", name);
  134.     printf("\t Customer  : %s   \t       Age:%d ", name, age);
  135.     printf("\t\t\t                       Date      : 5-07-2021\n");
  136.     printf("\n\t---------Press A ------11.00AM-12.00PM----------------\n");
  137.     printf("\n\t---------Press B ------01.00PM-02.00PM----------------\n");
  138.     printf("\n\t---------Press C ------02.00PM-03.00PM----------------\n");
  139.     printf("\n\t---------Press D ------03.00PM-04.00PM----------------\n");
  140.     printf("\t============================================================\n");
  141.     choice = toupper(getch());
  142.     if (choice == 'A')
  143.     {
  144.         sitplan();
  145.         getch();
  146.     }
  147.     else if (choice == 'B')
  148.     {
  149.         sitplan();
  150.         getch();
  151.     }
  152.     else if (choice == 'C')
  153.     {
  154.         sitplan();
  155.         getch();
  156.     }
  157.     else if (choice == 'D')
  158.     {
  159.         sitplan();
  160.         getch();
  161.     }
  162. }
  163. void ticket3()
  164. {
  165.     system("cls");
  166.     printf("\n\n");
  167.     printf("\t-----------------Input Pessenger Details----------------\n");
  168.     printf("\t----------------Enter Your Name--------------------------\n");
  169.     printf("\t---------------->");
  170.     gets(name);
  171. }
  172.  
  173. int ticket4()
  174. {
  175.     system("cls");
  176.     int age;
  177.     printf("\n\n");
  178.     printf("\t-----------------Input Pessenger Details----------------\n");
  179.     printf("\t----------------Your Age?-------------------------------\n");
  180.     printf("\t---------------->");
  181.     scanf("%d", &age);
  182.     return age;
  183. }
  184.  
  185. void help()
  186. {
  187.     char str [100]="]dpdq#Vkhlnk";
  188.     for(int i = 0; (i < 100 && str[i] != '\0'); i++){
  189.         str[i] = str[i] - 3;
  190.     }
  191.     system("cls");
  192.     printf("\n ---------  Welcome to Train Ticket Booking Apps----------------");
  193.     printf("\n\n Here are some tips for:          ");
  194.     printf("\n ---------------------------------------------------------------");
  195.     printf("\nApps is Developed by %s ",str);
  196.     printf("\n Press any other key to return to the main menu!");
  197.     getch();
  198. }
  199.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement