Tourism Management System
Tourism Management System
TOURISM MANAGEMENT
SYSTEM
SUBMITTED BY
1.Tanay Kumar Prasad
2.Tushal Kumar
•A structure is implemented for taking the details of the passengers like name,
gender, and age.
• Six functions– void details(), void add_node(char, char, int), void receipt(), void
heading(), void inter(), void india() are created to handle different functionality.
• The heading() function is declared that will make the heading of the portal.
• Some character arrays are defined and some integer arrays as globally.
• The user has to give choice for International or Indian Tour packages.
• If the user choose International tour packages then inter() function will be called.
• If the user choose the India tour package then india() function will be called. Here,
• A for loop will be executed to take details of each passenger. Then the taken
details will be sent to the add_node() function.
• In the add_node function, every detail will store into a node for each passenger.
This node will link each other. This is based on the linked list concept.
• At last, the receipt() function will be called, which will display all the necessary
details.
CODE-
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
enum state{menu,loggedin};
char username[100];
char password[100];
char place[100];
float price;
int numtick;
}user;
void ShowBrochure();
user* InitializeList(user*);
user* AddUser(user*);
void LoginUser(user*);
void BookTicket(user*);
void PrintTicket(user*);
void CancelTicket(user*);
void ChangePassword(user*);
void LogoutUser();
void CheckTicket(user*);
void DisplayAll(user*);
void WriteToFile(user*);
void ExitProgram();
char currentuser[100];
int main()
user *h=NULL;
int ch1,ch2;
h=InitializeList(h);
while (1)
if(currentstate==menu)
scanf("%d",&ch1);
switch(ch1)
{
case 1:
h=AddUser(h);
break;
case 2:
LoginUser(h);
break;
case 3:
ShowBrochure();
break;
case 4:
ExitProgram();
exit(0);
break;
default:
else if(currentstate==loggedin)
system("CLS");
printf("\n\t\t\t\t=========================");
printf("\n\t\t\t\t=========================\n");
scanf("%d",&ch2);
switch(ch2)
case 1:
BookTicket(h);
system("PAUSE");
system("CLS");
break;
case 2:
CheckTicket(h);
system("PAUSE");
system("CLS");
break;
case 3:
PrintTicket(h);
system("PAUSE");
system("CLS");
break;
case 4:
CancelTicket(h);
system("PAUSE");
system("CLS");
break;
case 5:
ChangePassword(h);
system("PAUSE");
system("CLS");
break;
case 6:
LogoutUser(h);
system("PAUSE");
system("CLS");
break;
case 7:
ShowBrochure();
system("PAUSE");
system("CLS");
break;
case 8:
ExitProgram();
exit(0);
break;
default:
return 0;
}
user* InitializeList(user *h)
user* t,*ptr,temp;
FILE *fp;
int cc=0,x;
float ff;
fp=fopen("users.txt","r");
if(fp==NULL)
return NULL;
if(fgetc(fp)==EOF)
return NULL;
rewind(fp);
while(fscanf(fp,"%s %s %s %f
%d",temp.username,temp.password,temp.place,&temp.price,&temp.numtick)!=EOF)
ptr=(user*)malloc(sizeof(user));
strcpy(ptr->username,temp.username);
strcpy(ptr->password,temp.password);
strcpy(ptr->place,temp.place);
ptr->price=temp.price;
ptr->numtick=temp.numtick;
ptr->next=NULL;
if(h==NULL)
h=t=ptr;
else
h->next=ptr;
h=ptr;
fclose(fp);
return t;
FILE *fp;
fp=fopen("users.txt","w");
while(h!=NULL)
fprintf(fp,"%s %s %s %f %d\n",h->username,h->password,h->place,h->price,h->numtick);
h=h->next;
fclose(fp);
}
void ShowBrochure()
system("CLS");
"5. AND - Hawaii - $120\n6. BHB - Atlanta Vacation - $10\n7. AG - San Francisco - $30\n8. ND -
Alaska Vacation - $32000\n9. RJ - Orlando Vacation - Rs 45\n10. SI - South US Tour - $25\n");
while(h!=NULL)
if(!strcmp(h->username,currentuser))
break;
h=h->next;
return;
float total=0.0;
total=(h->price)*(h->numtick);
printf("You have booked %d tickets for a sum total of $ %f for tour code %s\n",h->numtick,total,h-
>place);
}
user* AddUser(user* h)
user *t;
t=h;
user *nw;
nw=(user*)malloc(sizeof(user));
fflush(stdin);
scanf("%s",nw->username);
while(h!=NULL)
if(!strcmp(h->username,nw->username))
return t;
h=h->next;
h=t;
fflush(stdin);
printf("Enter password\n");
scanf(" %[^\n]s",&nw->password);
nw->next=NULL;
strcpy(nw->place,"N/A");
nw->price=0.0;
nw->numtick=0;
if(h==NULL)
h=t=nw;
else
while(h->next!=NULL)
h=h->next;
h->next=nw;
WriteToFile(t);
return t;
void LoginUser(user* h)
char username[100];
char password[100];
fflush(stdin);
printf("\n\n");
printf("\t\tEnter Email/Username:\n\t\t");
scanf("%s",username);
fflush(stdin);
printf("\n\t\tEnter Password:\n\t\t");
scanf(" %[^\n]s",password);
while(h!=NULL)
currentstate=loggedin;
strcpy(currentuser,username);
printf("\n\t\tLogin successful!\n");
system("PAUSE");
return;
printf("Password mismatch\n");
return;
h=h->next;
user *t=h;
char place[100];
while(h!=NULL)
if(!strcmp(h->username,currentuser))
break;
h=h->next;
if(h==NULL)
return;
if(h->price!=0.0)
printf("You must cancel your previous ticket before buying a new one\n");
return;
ShowBrochure();
float pricelist[]={40.0,60.0,25.0,38.0,120.0,10.0,30.0,32.0,45.0,25.0};
fflush(stdin);
scanf(" %[^\n]s",place);
char choice;
fflush(stdin);
scanf("%c",&choice);
float price;
if(choice!='1')
return;
if(strcmp(place,"LL")==0)
price=pricelist[0];
else if(strcmp(place,"JK")==0)
price=pricelist[1];
else if(strcmp(place,"SK")==0)
price=pricelist[2];
else if(strcmp(place,"SHM")==0)
price=pricelist[3];
else if(strcmp(place,"AND")==0)
price=pricelist[4];
else if(strcmp(place,"BHB")==0)
price=pricelist[5];
else if(strcmp(place,"AG")==0)
price=pricelist[6];
else if(strcmp(place,"ND")==0)
price=pricelist[7];
else if(strcmp(place,"RJ")==0)
price=pricelist[8];
else if(strcmp(place,"SI")==0)
price=pricelist[9];
else
return;
scanf("%d",&h->numtick);
if(h->numtick==0)
return;
strcpy(h->place,place);
h->price=price;
WriteToFile(t);
printf("Bookings Done!!\n");
system("PAUSE");
while(h!=NULL)
if(!strcmp(h->username,currentuser))
break;
h=h->next;
}
return;
float total=0.0;
total=(h->price)*(h->numtick);
FILE *fp;
char filename[50];
strcpy(filename,h->username);
strcat(filename,"_ticket.txt");
fp=fopen(filename,"w");
if(fp==NULL)
return;
if(fgetc(fp)==EOF)
fprintf(fp,"TOURISM TICKET\n===============\n\n");
fprintf(fp,"Email ID: %s\nTour Code: %s\nTicket Cost: $ %f\nNumber of tickets: %d\nTotal Cost: $ %f\
n",h->username,h->place,h->price,h->numtick,total);
fclose(fp);
}
void CancelTicket(user *h)
user *t=h;
while(h!=NULL)
if(!strcmp(h->username,currentuser))
break;
h=h->next;
int flag=-1;
if(h==NULL)
if(strcmp(h->place,"LL")==0)
flag++;
else if(strcmp(h->place,"JK")==0)
flag++;
else if(strcmp(h->place,"SK")==0)
flag++;
else if(strcmp(h->place,"SHM")==0)
flag++;
else if(strcmp(h->place,"AND")==0)
flag++;
else if(strcmp(h->place,"BHB")==0)
flag++;
else if(strcmp(h->place,"AG")==0)
flag++;
else if(strcmp(h->place,"ND")==0)
flag++;
else if(strcmp(h->place,"RJ")==0)
flag++;
else if(strcmp(h->place,"SI")==0)
flag++;
else
return;
if(flag==0)
printf("Your ticket has been successfully cancelled\nA refund of $ %f for Tour Code %s for %d tickets
will soon be made to your original source of purchase\n",h->price,h->place,h->numtick);
strcpy(h->place,"N/A");
h->price=0.0;
h->numtick=0;
WriteToFile(t);
}
void ChangePassword(user *h)
user *t=h;
char passcurr[100];
fflush(stdin);
scanf(" %[^\n]s",passcurr);
while(h!=NULL)
if(!strcmp(h->username,currentuser))
break;
h=h->next;
if(h==NULL)
return;
if(!strcmp(passcurr,h->password))
scanf(" %[^\n]s",h->password);
WriteToFile(t);
void LogoutUser()
{
if(currentstate==menu || strcmp(currentuser,"\0")==0)
return;
strcpy(currentuser,"\0");
currentstate=menu;
void ExitProgram()
char exitprog;
fflush(stdin);
scanf("%c",&exitprog);
}b
OUTPUT-
CONCLUSION –
The given cod is the main drive code which is able to make a proper interface to
interact with the customer. The given code will take a proper travelling package
from the user and then take personal details of the customer and their date of
departure .After that the payment is done and the receipt is given. The project code
can be used in for tourism industries in a full fledge fashion.
The code take takes the user name and the password from the user to log in, if the
id or password is incorrect the code will display it . Then the user is to selected the
list of package from the list and the final amount and the date of departure is taken
and confirm .
CREDITS
www.geeksofgeeks.com