Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void menu();
  5. void depature();
  6.  
  7. char Username[50];
  8. char Password[50];
  9. char email;
  10. int phone;
  11. float price,i;
  12. int y,origin,dest;
  13. int departDate;
  14. int return_date;
  15. int num_person;
  16. int departure_time;
  17. int return_time;
  18.  
  19. void Login()
  20. {
  21.     printf("Username: ");
  22.     scanf("%s", &Username);
  23.  
  24.     printf("Password: ");
  25.     scanf("%s", &Password);
  26. }
  27.  
  28. void checkLogin()
  29. {
  30.     if(strcmp(Username,"Namira") == 0 || strcmp(Username,"Ahmad_Ali") == 0 || strcmp(Username,"Nuha_Ali") == 0 || strcmp(Username,"Amalin") == 0 || strcmp(Username,"Ammar") == 0){
  31.         if(strcmp(Password,"Mira") == 0 || strcmp(Password,"doubleA") == 0 || strcmp(Password,"NH") == 0 || strcmp(Password,"amal") == 0 || strcmp(Password,"ammarI") == 0){
  32.             printf("You have logged in successfully.\n");
  33.         }else{
  34.             printf("Wrong username or password.");
  35.             exit(1);
  36.         }
  37.     }else{
  38.         printf("Wrong username or password.");
  39.         exit(1);
  40.     }
  41.  
  42.      printf("\n\t************************************************************");
  43.      printf("\n\t************************************************************");
  44.      system("cls");
  45.  
  46. }
  47.  
  48. int main()
  49. {
  50.     printf("\n\t************************************************************");
  51.     printf("\n\t************************************************************");
  52.     printf("\n\t************************************************************");
  53.     printf("\n\t********                                            ********");
  54.     printf("\n\t********             PERFECT YOUR JOURNEY           ********");
  55.     printf("\n\t********             TRAIN TICKET ONLINE            ********");
  56.     printf("\n\t********              GET YOUR OWN NOW!             ********");
  57.     printf("\n\t********                                            ********");
  58.     printf("\n\t************************************************************");
  59.     printf("\n\t************************************************************");
  60.     printf("\n\t************************************************************");
  61.  
  62.      printf("\n");
  63.      printf("\n");
  64.      printf("\nDo you have an excisting account?");
  65.      printf("\n");
  66.      printf("\n");
  67.  
  68.      printf("\n(1-yes/2-no): ");
  69.      scanf("%d",&y);
  70.      system("cls");
  71.  
  72.     if(y==1){
  73.         Login();
  74.         checkLogin();
  75.         menu();
  76.     }else{
  77.         printf("\nCreate new account");
  78.         printf("\nEmail: ");
  79.         scanf("%s",&email);
  80.         printf("\nNo.phone: ");
  81.         scanf("%d",&phone);
  82.         printf("\nUsername: ");
  83.         scanf("%s",&Username);
  84.         system("cls");
  85.         menu();
  86.     }
  87.  
  88.     return 0;
  89. }
  90.  
  91. void menu()
  92. {
  93.     printf("\n\t************************************************************");
  94.     printf("\n\t************************************************************");
  95.  
  96.     printf("\nChoose Your Origin");
  97.      printf("\n^*^*^*^*^*^*^*^*^");
  98.      printf("\n1 - Johor bahru");
  99.      printf("\n2 - Seremban");
  100.      printf("\n3 - Kuala Lumpur");
  101.      printf("\n4 - Kuantan");
  102.      printf("\n^*^*^*^*^*^*^*^*^");
  103.      printf("\nEnter Your Origin: ");
  104.      scanf("%d",&origin);
  105.      system("cls");
  106.  
  107.      switch(origin)
  108.      {
  109.     case 1:
  110.       printf("\nChoose Your Destination");
  111.       printf("\n^*^*^*^*^*^*^*^*^*^*^");
  112.       printf("\nN1 Johor Bahru -> Bangi ");
  113.       printf("\nN2 Johor Bahru -> Kuantan ");
  114.       printf("\nN3 Johor Bahru -> Melaka ");
  115.       printf("\nN4 Johor Bahru -> Kedah ");
  116.       printf("\n^*^*^*^*^*^*^*^*^*^*^");
  117.       printf("\nEnter Your Destination: ");
  118.       scanf("%d",&dest);
  119.       if(dest==1){
  120.         price=10;
  121.       }else if(dest==2){
  122.         price=12;
  123.       }else if(dest==3){
  124.         price=14;
  125.       }else if(dest==4){
  126.         price=15;
  127.       }
  128.       system("cls");
  129.       depature(price);
  130.       break;
  131.     case 2:
  132.       printf("\nChoose Your Destination");
  133.       printf("\n^*^*^*^*^*^*^*^*^*^*^");
  134.       printf("\nN1 Seremban -> Kuala Lumpur ");
  135.       printf("\nN2 Seremban -> Johor Bahru ");
  136.       printf("\nN3 Seremban -> Melaka ");
  137.       printf("\nN4 Seremban -> Perlis ");
  138.       printf("\n^*^*^*^*^*^*^*^*^*^*^");
  139.       printf("\nEnter Your Destination: ");
  140.       scanf("%d",&dest);
  141.       if(dest==1){
  142.         price=10;
  143.       }else if(dest==2){
  144.         price=12;
  145.       }else if(dest==3){
  146.         price=14;
  147.       }else if(dest==4){
  148.         price=15;
  149.       }
  150.       system("cls");
  151.       depature(price);
  152.       break;
  153.     case 3:
  154.       printf("\nChoose Your Destination");
  155.       printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
  156.       printf("\nN1 Kuala Lumpur -> Kuala Pilah");
  157.       printf("\nN2 Kuala Lumpur -> Kuantan ");
  158.       printf("\nN3 Kuala Lumpur -> segamat ");
  159.       printf("\nN4 Kuala Lumpur -> Nilai ");
  160.       printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
  161.       printf("\nEnter Your Destination: ");
  162.       scanf("%d",&dest);
  163.       if(dest==1){
  164.         price=10;
  165.       }else if(dest==2){
  166.         price=12;
  167.       }else if(dest==3){
  168.         price=14;
  169.       }else if(dest==4){
  170.         price=15;
  171.       }
  172.       system("cls");
  173.       depature(price);
  174.       break;
  175.     case 4:
  176.       printf("\nChoose Your Destination");
  177.       printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
  178.       printf("\nN1 Kuantan -> Kuala Pilah");
  179.       printf("\nN2 Kuantan -> Johor Bahru ");
  180.       printf("\nN3 Kuantan -> segamat ");
  181.       printf("\nN4 Kuantan -> Nilai ");
  182.       printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
  183.       printf("\nEnter Your Destination: ");
  184.       scanf("%d",&dest);
  185.       if(dest==1){
  186.         price=10;
  187.       }else if(dest==2){
  188.         price=12;
  189.       }else if(dest==3){
  190.         price=14;
  191.       }else if(dest==4){
  192.         price=15;
  193.       }
  194.       system("cls");
  195.       depature(price);
  196.       break;
  197.     default:
  198.         printf("Wrong option\n");
  199.       }
  200. }
  201.  
  202. void depature()
  203. {
  204.     printf("\nDeparture Date(140717): ");
  205.     scanf("%d",&departDate);
  206.     printf("\nReturn Date(160717): ");
  207.     scanf("%d",&return_date);
  208.     printf("\nNumber Of Person: ");
  209.     scanf("%d",&num_person);
  210.     system("cls");
  211.  
  212.      i=price*num_person;
  213.  
  214.  
  215.      printf("\n\t****************************************");
  216.      printf("\n\t****************************************");
  217.      printf("\n\t***     Depature Date:    %d     ***",departDate);
  218.      printf("\n\t***     Return date:      %d     ***",return_date);
  219.      printf("\n\t***     Number Of Person: %d          ***",num_person);
  220.      printf("\n\t***     Departure Time:   14:35      ***",departure_time);
  221.      printf("\n\t***     Return Time:      09:15      ***",return_time);
  222.      printf("\n\t***     Total Price:      %.2f      ***",i);
  223.      printf("\n\t****************************************");
  224.      printf("\n\t****************************************");
  225. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement