Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void menu();
- void departure();
- void checkAccount();
- char Username[50];
- char Password[50];
- char email[50],newName[50];
- char cancel;
- int phone;
- float price,total;
- int y,origin,dest,deptdd,deptmm,deptyy,retdd,retmm,retyy;
- int num_person;
- int departure_time;
- int return_time;
- char accno[20];
- //============================================================================================================================//
- void Login()
- {
- printf("\n");
- printf("Username: ");
- scanf("%s", &Username);
- printf("\n");
- printf("\nPassword: ");
- scanf("%s", &Password);
- }
- //============================================================================================================================//
- void checkLogin()
- {
- if(strcmp(Username,"Namira") == 0 || strcmp(Username,"Ahmad_Ali") == 0 || strcmp(Username,"Nuha_Ali") == 0 ||
- strcmp(Username,"Amalin") == 0|| strcmp(Username,"Ammar") == 0)
- {
- if(strcmp(Password,"Mira") == 0 || strcmp(Password,"doubleA") == 0 || strcmp(Password,"NH") == 0 ||
- strcmp(Password,"amal") == 0 || strcmp(Password,"ammarI") == 0){
- printf("You have logged in successfully.\n");
- }
- else{
- printf("Wrong username or password.");
- exit(1);
- }
- }
- else{
- printf("Wrong username or password.");
- exit(1);
- }
- printf("\n\t************************************************************");
- printf("\n\t************************************************************");
- system("cls");
- }
- //============================================================================================================================//
- int main()
- {
- int num1;
- printf("\n\t************************************************************");
- printf("\n\t************************************************************");
- printf("\n\t************************************************************");
- printf("\n\t******** ********");
- printf("\n\t******** PERFECT YOUR JOURNEY ********");
- printf("\n\t******** TRAIN TICKET ONLINE ********");
- printf("\n\t******** GET YOUR OWN NOW! ********");
- printf("\n\t******** ********");
- printf("\n\t************************************************************");
- printf("\n\t************************************************************");
- printf("\n\t************************************************************");
- printf("\n");
- printf("\n");
- printf("\nDo you have an existing account?");
- printf("\n");
- printf("\n");
- printf("\n(1-yes/2-no): ");
- scanf("%d",&y);
- system("cls");
- if(y==1){
- Login();
- checkLogin();
- menu();
- }
- else{
- printf("\nCreate new account");
- printf("\n");
- printf("\nEmail: ");
- scanf("%s",&email);
- printf("\nNo.phone: ");
- scanf("%d",&phone);
- printf("\nUsername: ");
- scanf("%s",&newName);
- system("cls");
- menu();
- }
- return 0;
- }
- //============================================================================================================================//
- void menu()
- {
- printf("\n\t************************************************************");
- printf("\n\t************************************************************");
- printf("\nChoose Your Origin");
- printf("\n^*^*^*^*^*^*^*^*^");
- printf("\n1 - Johor bahru");
- printf("\n2 - Seremban");
- printf("\n3 - Kuala Lumpur");
- printf("\n4 - Kuantan");
- printf("\n^*^*^*^*^*^*^*^*^");
- printf("\nEnter Your Origin: ");
- scanf("%d",&origin);
- system("cls");
- switch(origin)
- {
- case 1:
- printf("\nChoose Your Destination");
- printf("\n^*^*^*^*^*^*^*^*^*^*^");
- printf("\nN1 Johor Bahru -> Bangi ");
- printf("\nN2 Johor Bahru -> Kuantan ");
- printf("\nN3 Johor Bahru -> Melaka ");
- printf("\nN4 Johor Bahru -> Kedah ");
- printf("\n^*^*^*^*^*^*^*^*^*^*^");
- printf("\n\nPress 1-4 to choose the destination or\n");
- printf("Press anything to cancel.\n");
- printf("Option: ");
- scanf("%d",&dest);
- if(dest==1){
- price=40.80;
- }else if(dest==2){
- price=54.99;
- }else if(dest==3){
- price=25.50;
- }else {
- price=70.20;
- }
- system("cls");
- if(dest==1 || dest==2 || dest==3 || dest==4)
- {
- departure();
- }
- else
- {
- system("cls");
- main();
- }
- departure(price);
- break;
- case 2:
- printf("\nChoose Your Destination");
- printf("\n^*^*^*^*^*^*^*^*^*^*^");
- printf("\nN1 Seremban -> Kuala Lumpur ");
- printf("\nN2 Seremban -> Johor Bahru ");
- printf("\nN3 Seremban -> Melaka ");
- printf("\nN4 Seremban -> Perlis ");
- printf("\n^*^*^*^*^*^*^*^*^*^*^");
- printf("\n\nPress 1-4 to choose the destination or\n");
- printf("Press anything to cancel.\n");
- printf("Option: ");
- scanf("%d",&dest);
- if(dest==1){
- price=15.20;
- }else if(dest==2){
- price=38.30;
- }else if(dest==3){
- price=10.50;
- }else {
- price=54.60;
- }
- system("cls");
- if(dest==1 || dest==2 || dest==3 || dest==4)
- {
- departure();
- }
- else
- {
- system("cls");
- main();
- }
- departure(price);
- break;
- case 3:
- printf("\nChoose Your Destination");
- printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
- printf("\nN1 Kuala Lumpur -> Kuala Pilah");
- printf("\nN2 Kuala Lumpur -> Kuantan ");
- printf("\nN3 Kuala Lumpur -> segamat ");
- printf("\nN4 Kuala Lumpur -> Nilai ");
- printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
- printf("\n\nPress 1-4 to choose the destination or\n");
- printf("Press anything to cancel.\n");
- printf("Option: ");
- scanf("%d",&dest);
- if(dest==1){
- price=20.02;
- }else if(dest==2){
- price=30.05;
- }else if(dest==3){
- price=18.90;
- }else {
- price=11.70;
- }
- system("cls");
- if(dest==1 || dest==2 || dest==3 || dest==4)
- {
- departure();
- }
- else
- {
- system("cls");
- main();
- }
- departure(price);
- break;
- case 4:
- printf("\nChoose Your Destination");
- printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
- printf("\nN1 Kuantan -> Kuala Pilah");
- printf("\nN2 Kuantan -> Johor Bahru ");
- printf("\nN3 Kuantan -> segamat ");
- printf("\nN4 Kuantan -> Nilai ");
- printf("\n^*^*^*^*^*^*^*^*^*^*^*^*^*^*^");
- printf("\n\nPress 1-4 to choose the destination or\n");
- printf("Press anything to cancel.\n");
- printf("Option: ");
- scanf("%d",&dest);
- if(dest==1){
- price=48.40;
- }else if(dest==2){
- price=50.30;
- }else if(dest==3){
- price=23.10;
- }else {
- price=30.30;
- }
- system("cls");
- if(dest==1 || dest==2 || dest==3 || dest==4)
- {
- departure();
- }
- else
- {
- system("cls");
- main();
- }
- departure(price);
- break;
- default:
- printf("Wrong option\n");
- }
- }
- //============================================================================================================================//
- void departure(int num1)
- {
- printf("\nDeparture Date(14/07/17):");
- scanf("%d/%d/%d",&deptdd,&deptmm,&deptyy);
- printf("\nReturn Date(16/07/17): ");
- scanf("%d/%d/%d",&retdd,&retmm,&retyy);
- printf("\nNumber Of Person: ");
- scanf("%d",&num_person);
- system("cls");
- total=price*num_person;
- printf("\n\t----------------------------------------");
- printf("\n\t----------------------------------------");
- printf("\n\t| Departure Date: %d/%d/%d |",deptdd,deptmm,deptyy);
- printf("\n\t| Return date: %d/%d/%d |",retdd,retmm,retyy);
- printf("\n\t| Number of person: %d |",num_person);
- printf("\n\t| Departure Time: 14:35 |",departure_time);
- printf("\n\t| Return Time: 09:15 |",return_time);
- printf("\n\t| Total Price: %.2f |",total);
- printf("\n\t----------------------------------------");
- printf("\n\t----------------------------------------");
- printf("\n");
- printf("\n");
- printf("Your receipt will sending to your email");
- printf("\nEnter your account number: ");
- scanf("%s", &accno);
- system("cls");
- checkAccount();
- system("cls");
- printf("\n\t***********************************************");
- printf("\n\t***********************************************");
- printf("\n");
- printf("\n\tYOUR TRANSACTION IS SUCCESSFUL!");
- printf("\n\tThank You for using our service");
- printf("\n\tContact us if you have any problems 0196387893.");
- printf("\n");
- printf("\n\t***********************************************");
- printf("\n\t***********************************************");
- }
- //============================================================================================================================//
- void checkAccount()
- {
- if(strcmp(accno,"1234567890") == 0|| strcmp(accno,"9876543210") == 0|| strcmp(accno,"2345678910") == 0||
- strcmp(Username,"3456789120") == 0|| strcmp(accno,"4567891230")==0){
- printf("YOUR TRANSACTION IS SUCCESSFUL!");
- }
- else{
- printf("Wrong account number.");
- exit(1);
- }
- }
- //============================================================================================================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement