0% found this document useful (0 votes)
34 views

CSE-104 Lab Project Presentation

The document describes an existing online bus ticket reservation system and proposes a new system to improve upon it. The existing system allows users to view bus routes, book tickets, and check bus status, but it has limitations. Bookings are stored in text files associated with each bus, which could result in data issues. The proposed new system aims to address these limitations and allow users to more easily book and cancel tickets online.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

CSE-104 Lab Project Presentation

The document describes an existing online bus ticket reservation system and proposes a new system to improve upon it. The existing system allows users to view bus routes, book tickets, and check bus status, but it has limitations. Bookings are stored in text files associated with each bus, which could result in data issues. The proposed new system aims to address these limitations and allow users to more easily book and cancel tickets online.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

01

Green University of Bangladesh


Department of Computer Science and Engineering
Course Title: Structural Programming Lab
Presentation: Online Bus Ticket Reservation System
Presented By: Presented To:
Student Name: Anwarul Azim Sayem Md. Rajibul Palas
Student ID: 221002276 LECTURER
Section: 221-DL Department of C.S.E
Department: C.S.E
TO MY PRESENTATION
02

Presentation: Online Bus Ticket Reservation System


Table of contents 03

 Introduction
 Objectives
 Existing System
 System Result
 Software Requirement
 Conclusion
Introduction 04
05

OBJECTIVES

o To develop a system where people could be book an advance online ticket.

o They could be cancel their booking using this system

o They also know the bus status in this system.


Existing System 06

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char ch[20][450]={"Green Line","Volvo Travels","Shohag Express","Desh Travels","National Travels","Saudia Travels","Ena Travels"};
int busno;
void bus();
void booking();

void login()
{
int a=0, i=0;
char username[10],c=' ';
char pword[10], code[10];
char user[10] ="project";
char pass[10] ="cse";
do
{
system("cls");
printf ("\n =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= LOGIN FORM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= ");
printf (" \n ENTER YOUR USERNAME:-");
scanf ("%s", &username);
printf (" \n ENTER YOUR PASSWORD:-");
while (i<10)
{ Existing System
pword[i]=getch();
c=pword[i];
07
if(c==13)
break;
else
printf ("*");
i++;
}
pword[i]='\0';
i=0;
if (strcmp(username,"project")==0 && strcmp(pword,"cse")==0)
{
printf (" \n\n\n YOUR LOGIN IS SUCCESSFUL");
printf (" \n\n\n WELCOME TO OUR ONLINE RESERVATION SYSTEM");
printf ("\n\n\n\t\t\t\tPress any key to continue your reservation...");
getch();
break;
}

else
{
printf ("\n SORRY !!!! YOUR LOGIN IS UNSUCESSFUL");
a++;
getch();
}
} while (a<=2);
if (a>2)
{
printf("\nSorry you have entered the wrong username and password for more times!!!");
getch();
}
system("cls");
} //========>>>>>>>>>End of Login function
int main()
{ Existing System
login();
int num;
08
do
{ system("cls");
printf ("\n\n\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= WELCOME TO BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("\t\t\t\t[1]=> View Our Bus List\n\n");
printf ("\t\t\t\t[2]=> Booking Your Tickets\n\n");
printf ("\t\t\t\t[3]=> Cancle Your Booking\n\n");
printf ("\t\t\t\t[4]=> Bus Status Board\n\n");
printf ("\t\t\t\t[5]=> Exit\n\n");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n");
printf ("\t\t\tEnter Your Choice:: ");
scanf ("%d",&num);
switch (num)
{ case 1:
bus();
break;
case 2:
booking();
break;
case 3:
cancle();
break;
case 4:
status();
break;
} getch();
} while (num != 5);
system("cls");
{ printf ("\t-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n");
printf ("\n\t\t\t\t\tThank You For Using This System\t\t\t\t\t\t\n\n");
printf ("\t-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n");
} return 0;
} //=================>>>>>>>>>>>End of Main function
Existing System
09

void bus()
{
system("cls");
printf ("\n\n\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("\t\t\t\t\t[1] => %s\n\n",ch[0]);
printf ("\t\t\t\t\t[2] => %s\n\n",ch[1]);
printf ("\t\t\t\t\t[3] => %s\n\n",ch[2]);
printf ("\t\t\t\t\t[4] => %s\n\n",ch[3]);
printf ("\t\t\t\t\t[5] => %s\n\n",ch[4]);
printf ("\t\t\t\t\t[6] => %s\n\n",ch[5]);
printf ("\t\t\t\t\t[7] => %s\n\n",ch[6]);
}

void bus_details()
{
system("cls");
printf ("\n\n\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("\t\t\t\t\t[1] Dhaka to Cox's Bazar ==> %s\n\n",ch[0]);
printf ("\t\t\t\t\t[2] Dhaka to Sylhet ======> %s\n\n",ch[1]);
printf ("\t\t\t\t\t[3] Dhaka to Khulna ======> %s\n\n",ch[2]);
printf ("\t\t\t\t\t[4] Dhaka to Mymensingh ==> %s\n\n",ch[3]);
printf ("\t\t\t\t\t[5] Dhaka to Bandarban ===> %s\n\n",ch[4]);
printf ("\t\t\t\t\t[6] Dhaka to Chittagong ===> %s\n\n",ch[5]);
printf ("\t\t\t\t\t[7] Dhaka to Rajshahi ====> %s\n\n",ch[6]);
}
void booking()
{
int i=0;
char numstr[100];
Existing System
10
system("cls");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
bus();
printf ("Enter the Bus number:--->");
scanf ("%d",&busno);

system("cls");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("Your Bus Number is %d ********** %s",busno,ch[busno-1]); else if (busno == 4)
{
status_1(busno); f1 = fopen("tr4.txt","r+");
FILE *f1, *fopen(); fgets(str1,80,f1);
char str1[80]="32",str2[4],str3[4]; fclose(f1);
int seat1,seat2,booking=0; }
if (busno== 1) else if (busno == 5)
{ {
f1 = fopen("tr1.txt","r+"); f1 = fopen("tr5.txt","r+");
fgets(str1,80,f1); fgets(str1,80,f1);
fclose(f1); fclose(f1);
} }
else if (busno == 2) else if (busno == 6)
{ {
f1 = fopen("tr2.txt","r+"); f1 = fopen("tr6.txt","r+");
fgets(str1,80,f1); fgets(str1,80,f1);
fclose(f1); fclose(f1);
} }
else if (busno == 3) else if (busno == 7)
{ {
f1 = fopen("tr3.txt","r+"); f1 = fopen("tr7.txt","r+");
fgets(str1,80,f1); fgets(str1,80,f1);
fclose(f1); fclose(f1);
} }
Existing System
11
seat1=atoi(str1); //=======>>>>>>covert string into the number else if (busno == 3)
if (seat1 <= 0) {
{ f1 = fopen("tr3.txt","w");
printf ("There is no blank seat in this bus "); fputs(str1,f1);
} fclose(f1);
else }
{ else if (busno == 4)
printf ("\n\n\n\t\t\t\tAvailable Seats:------>%d\n",seat1); {
printf ("\n\t\t\t\tNumber of Tickets:----->"); f1 = fopen("tr4.txt","w");
scanf ("%d",&booking); fputs(str1,f1);
fclose(f1);
seat1=seat1-booking; }
itoa(busno,numstr,10); else if (busno == 5)
name_number(booking,numstr); {
f1 = fopen("tr5.txt","w");
printf ("\n\t\t\t\tThe Total booking amount is %d",200*booking); fputs(str1,f1);
itoa(seat1, str1, 10); fclose(f1);
} }
else if (busno == 6)
if (busno == 1) {
{ f1 = fopen("tr6.txt","w");
f1 = fopen("tr1.txt","w"); fputs(str1,f1);
fputs(str1,f1); fclose(f1);
fclose(f1); }
} else if (busno == 7)
else if (busno == 2) {
{ f1 = fopen("tr7.txt","w");
f1 = fopen("tr2.txt","w"); fputs(str1,f1);
fputs(str1,f1); fclose(f1);
fclose(f1); }
} }
Existing System
12

char name[32][100]={'\0'};
void name_number(int booking,char numstr[100])
{
char tempstr[100],tempstr1[12]="status",tempstr2[12]="number";//Declare the variable for name & seat number
int number, i;
FILE *a,*b;
strcat(numstr,".txt");
strcat(tempstr1,numstr);
strcat(tempstr2,numstr);
a = fopen(tempstr1,"a");//======>>>>>>for open the file to write the name in the file
b = fopen(tempstr2,"b");//======>>>>>>for open the file for writing the number in the file

for (i=0; i<booking; i++)//======>>>>>>for input the person name and seat number in the file
{
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Enter the details for ticket no %d =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n",i+1);
printf ("\t\t\t\tEnter the seat number:--->");
scanf ("%d",&number);
printf ("\t\t\t\tEnter the name of person:--->");
scanf ("%s",name[number-1]);
printf ("\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n");

itoa (number, tempstr, 10);


fprintf (a,"%s ",name[number-1]);
fprintf (b,"%s ",tempstr);
}
fclose(a);
fclose(b);
}
Existing System
char number[32][2]={'\0'}; 13
int num1[32]={0};
int read_number(int busno)//=======>>>>>for putting the numeric value in the array
{ void read_name(int busno)
char tempstr[100], numstr[100], tempstr2[12]="number"; {
int i=0, j=0, k; char numstr[100], tempstr1[12]="status";
FILE *a; int i=0,j=0,k=0;
itoa(busno,numstr,10); FILE *b;
strcat(numstr,".txt"); itoa(busno,numstr,10);
strcat(tempstr2,numstr); strcat(numstr,".txt");
a = fopen(tempstr2,"a+");//======>>>>>for open the file to write the name in the file strcat(tempstr1,numstr);
b = fopen(tempstr1,"a+");
while (!feof(a))
{ while (!feof(b))
number[i][j] = fgetc(a); {
if (number[i][j] == ' ') name[i][j] = fgetc(b);
{
j=0; if (name[i][j] == ' ')
i++; {
} j=0;
else i++;
{ }
j++; else
} {
} j++;
k=i; }
for (i=0; i<k; i++)
{ }
num1[i] = atoi(number[i]); name[i][j]='\0';
} k=i;
fclose(a); fclose(b);
return k; }
}
void status()
{
Existing System
int i, j, busno, index=0;
14
system("cls");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
bus_details();
printf ("Enter the number of bus:---->");
scanf ("%d",&busno);

j = read_number(busno);
read_name(busno);

system("cls");
printf ("____________________________________________________________________________________________________________________\n\n");
printf (" Bus.no--> %d ----> %s \n",busno,ch[busno-1]);
printf ("____________________________________________________________________________________________________________________\n");

char tempname[33][10]={"Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty
","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty "};

for (i=0; i<j; i++)


{
strcpy(tempname[num1[i]],name[i]);
}
for (i=0; i<8; i++)
{
printf ("\t\t\t\t");
for (j=0; j<4; j++)
{
printf ("%d.%s\t",index+1,tempname[index+1]);
index++;
}
printf ("\n");
}
}
Existing System
15
void status_1(int busno)
{
int i, j, index=0;

printf ("Your Bus Number is %d ********** %s",busno,ch[busno-1]);


system("cls");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");

j=read_number(busno);
read_name(busno);

char tempname[33][10]={"Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty
","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty "};
for (i=0; i<j; i++)
{
strcpy(tempname[num1[i]],name[i]);
}
for (i=0; i<8; i++)
{
printf ("\t\t\t\t");
for (j=0; j<4; j++)
{
printf ("%d.%s\t",index+1,tempname[index+1]);
index++;
}
printf ("\n");
}
}
Existing System
16
void cancle() for (i=0; i<32; i++)
{ {
int seat_no, i, j; if (num1[i] == seat_no)
char numstr[100], tempstr2[15]="number", tempstr1[15]="status"; {
for (j=0; j<32; j++)
printf("Enter the bus number:---->"); {
scanf("%d",&busno); if (num1[j] != seat_no && num1[j] != 0)
{
itoa(busno,numstr,10); fprintf(b,"%d ",num1[j]);
strcat(numstr,".txt"); fprintf(a,"%s",name[j]);
strcat(tempstr1,numstr); }
strcat(tempstr2,numstr); else if (num1[j] == seat_no && num1[j] != 0)
read_number(busno); {
read_name(busno); strcpy(name[j],"Empty ");
status_1(busno); }
}
printf ("Enter the seat number:--->"); }
scanf ("%d",&seat_no); }
fclose(a);
FILE *a,*b; fclose(b);
a = fopen(tempstr1,"w+");
b = fopen(tempstr2,"w+"); printf("\n\
n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n");
printf("\t\t\t\tYour 200 Taka has been Returned\t\t\t\n");

printf("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n");
}
System Result
17
System Result
18
System Result
19
Software Requirement 20

For develop this system here I use the Code Blocks and C programming language .
Conclusion 21

So, here I am going to develop a Online Bus Ticket Reservation System. As we


know that it is an instant system to booking or cancle a ticket . This system will
give us a user friendly interface and a secure platform than other developed
system. It will save the time to the users. We hope it will be a great system for us.

You might also like