0% found this document useful (0 votes)
40 views19 pages

Mini Project DSA

The document presents a mini project titled 'Bus Reservation System' developed in C programming, aimed at simplifying bus ticket booking. It includes functionalities for ticket booking, cancellation, seat status checking, and secure login, serving as a practical learning tool for programming concepts. The project is intended for educational purposes and can be enhanced with additional features for real-world applications.

Uploaded by

swndhaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views19 pages

Mini Project DSA

The document presents a mini project titled 'Bus Reservation System' developed in C programming, aimed at simplifying bus ticket booking. It includes functionalities for ticket booking, cancellation, seat status checking, and secure login, serving as a practical learning tool for programming concepts. The project is intended for educational purposes and can be enhanced with additional features for real-world applications.

Uploaded by

swndhaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Mini Project

On
Bus Reservation System
For
Data Structure and Algorithms (CAN605)

Submitted to: Submitted by:


Dr. Sanjay Kumar Sawan
Assistant Professor 1000026853
School of Computing MCA (P1)
DIT University I Yr (II Sem)

Session 2024-25
CERTIFICATE
Certified that project report entitled “Bus Reservation System” submitted by “Sawan ”
during the period 2024-2025 in partial fulfilment of the requirements for the award of degree
of MCA of DIT University, Dehradun, is a record of work carried out under my guidance and
supervision. The project report embodies result of referred work and studies carried out by
student themselves and the content of the report do not form the basis for the award of any
other degree to the candidate or to anybody of the team.

Dr. Sanjay Kumar

Asst. Professor

DIT University, Dehradun

ACKNOWLEDGEMENT
Apart from the efforts we put, the success of the project depends largely on the
encouragement and guidelines of many others. We take this opportunity to express my
gratitude to the people who have been instrumental in the successful completion of this
project.

We take immense pleasure in thanking Dr. Sanjay kumar for having permitted us to carry
out this project. We would like to express a deep sense of gratitude to Dr. Bharti Sharma,
Head of Department, MCA, for their able guidance and useful suggestions, which helped us
in completing the project in time.

Finally, yet importantly, we would like to express our heartfelt thanks to our parents for their
blessings, our friends for their help and wishes for the successful completion of this project.

ABSTRACT
The Bus Reservation System is a mini project developed in the C programming
language, aimed at simplifying the process of booking bus tickets. In real-life
scenarios, booking tickets manually can be time-consuming and stressful. This
system provides a computerized solution, enabling users to manage reservations
efficiently.

The project includes a Login System for authorized access and offers four main
functionalities: ticket booking, ticket cancellation, bus seat status checking, and
secure exit. Users can select seat numbers for booking, cancel previously
booked tickets, and view the current status of each seat. The system maintains
the state of 30 bus seats and ensures that bookings and cancellations are handled
securely.

This mini project serves as a foundation for understanding file handling, arrays,
conditional logic, and user-defined functions in C. It can be further enhanced by
incorporating file storage, multiple bus schedules, user registration, and a
graphical interface.

INDEX
1. Introduction

2. Software requirement

3. Source Code

4. Output

5. Result

6. Applications

7. Conclusion

8. Reference

Introduction
In today’s fast-paced world, transportation plays a crucial role in connecting people across
cities and states. However, the traditional method of booking bus tickets manually can be
inefficient, time-consuming, and prone to human error. To address this issue, we present a
simple yet effective Bus Reservation System developed using the C programming language.

This project is designed to simulate the process of booking and managing bus tickets in a
computerized environment. The system provides a user-friendly interface that allows users to
log in, book tickets, cancel bookings, and check the current status of bus seats. With a
capacity of 30 seats, the system ensures that no double booking or invalid seat assignment
occurs.

By implementing this project, we demonstrate key programming concepts such as arrays,


functions, conditional statements, loops, and basic user authentication in C. The project
serves as a practical learning tool for beginners and can be expanded into a full-fledged
reservation system with additional features like file handling, multiple bus routes, and
customer information.
Software Requirements

To successfully implement and run the Bus Reservation System, the following software
requirements must be met:

1. Programming Language:

C Programming Language: The core functionality of the project is built using C, as it provides
the necessary control over low-level operations, memory management, and the ability to
implement logic efficiently.

2. Integrated Development Environment (IDE) or Compiler:

Code::Blocks (Recommended) or any C IDE such as:

Visual Studio Code (with C extensions)

These IDEs provide a user-friendly environment to write, compile, and debug C programs.

3. Operating System:
The project can run on various operating systems, including:

Windows

Linux

macOS

The program uses basic file handling, which is supported across all platforms. However, the
specific IDE might vary in terms of operating system compatibility.

4. Compiler:
C compiler is required to compile the C code. Some common compilers are:

GCC (GNU Compiler Collection)


5. Text Editor (Optional):

Notepad++ or Sublime Text for writing and editing code, if you are not using an IDE.
Source Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define TOTAL_SEATS 30
#define PASSWORD "admin123"

int seats[TOTAL_SEATS] = {0}; // 0 means available, 1 means booked


int login();
void book_ticket();
void cancel_ticket();
void check_status();
void display_menu();

int main() {
if (!login()) {
printf("Login Failed. Exiting program.\n");
return 0;
}

int choice;
do {
display_menu();
printf("Enter your choice: ");
scanf("%d", &choice);

switch (choice) {
case 1:
book_ticket();
break;
case 2:
cancel_ticket();
break;
case 3:
check_status();
break;
case 4:
printf("Thank you for using the Bus Reservation System.\n");
break;
default:
printf("Invalid choice. Try again.\n");
}
} while (choice != 4);

return 0;
}

// Login function
int login() {
char pass[20];
printf("----- LOGIN -----\n");
printf("Enter Password: ");
scanf("%s", pass);

if (strcmp(pass, PASSWORD) == 0) {
printf("Login Successful.\n\n");
return 1;
} else {
printf("Incorrect Password!\n");
return 0;
}
}

void book_ticket() {
int seat_no;
char name[50];

printf("\n--- Ticket Booking ---\n");


printf("Enter your name: ");
scanf("%s", name);
printf("Enter seat number (1-%d): ", TOTAL_SEATS);
scanf("%d", &seat_no);

if (seat_no < 1 || seat_no > TOTAL_SEATS) {


printf("Invalid seat number.\n");
return;
}

if (seats[seat_no - 1] == 0) {
seats[seat_no - 1] = 1;
printf("Seat %d successfully booked for %s.\n", seat_no, name);
} else {
printf("Seat %d is already booked.\n", seat_no);
}
}

void cancel_ticket() {
int seat_no;
printf("\n--- Ticket Cancellation ---\n");
printf("Enter seat number to cancel (1-%d): ", TOTAL_SEATS);
scanf("%d", &seat_no);
if (seat_no < 1 || seat_no > TOTAL_SEATS) {
printf("Invalid seat number.\n");
return;
}

if (seats[seat_no - 1] == 1) {
seats[seat_no - 1] = 0;
printf("Seat %d has been cancelled.\n", seat_no);
} else {
printf("Seat %d is not booked yet.\n", seat_no);
}
}

void check_status() {
printf("\n--- Bus Seat Status ---\n");
for (int i = 0; i < TOTAL_SEATS; i++) {
printf("Seat %2d: %s\n", i + 1, seats[i] == 0 ? "Available" :
"Booked");
}
}

void display_menu() {
printf("\n--- Bus Reservation Menu ---\n");
printf("1. Book Ticket\n");
printf("2. Cancel Ticket\n");
printf("3. Check Bus Status\n");
printf("4. Exit\n");
}
Output
Result

The Bus Reservation System was successfully developed and executed using
the C programming language. The system provides a simple, interactive
interface that allows users to:

Log in securely using predefined credentials.

Book tickets by selecting available seat numbers.

Cancel previously booked tickets to free up seats.

Check the real-time status of bus seats, showing which are booked and which
are available.
All functionalities were tested and performed as expected. The system ensures
that:
No seat is booked more than once.

Only valid seat numbers can be selected.

Cancellations are only allowed for seats that are already booked.

This project demonstrates the practical application of basic programming constructs such as
arrays, conditionals, loops, and functions in C. It also lays the foundation for building more
advanced systems by introducing key concepts of user interaction and data handling.
Applications
The Bus Reservation System developed in C has several practical applications in
the real world, especially in the transportation and travel sectors. Some key
applications include:

1. Online Bus Ticket Booking Platforms:

This system serves as the foundational logic for real-time bus ticket booking
systems used by travel agencies and bus operators.

2. Transport Management Systems:

It can be integrated into broader transport management software to manage


seat availability, bookings, and cancellations for buses.

3. Kiosk-Based Booking Systems:

The logic can be used in self-service kiosks installed at bus terminals, allowing
passengers to book and cancel tickets without human assistance.

4. Educational Purposes:

This project is ideal for students and beginners learning programming concepts
such as arrays, conditional statements, loops, functions, and user input
handling.

5. Automation of Manual Ticketing:

Small bus operators who currently rely on manual booking processes can use a
system like this to reduce errors and improve efficiency.
6. Prototype for Future Development:

The current system can be enhanced with features like multiple bus schedules,
passenger information storage, payment integration, and database
connectivity for real-world deployment.
Conclusion

The Bus Reservation System developed in C effectively demonstrates how


technology can simplify the ticket booking process and improve user
experience. The system successfully incorporates essential features such as
login authentication, ticket booking, cancellation, and real-time seat status
checking.

Through this project, we gained hands-on experience with core programming


concepts including arrays, conditional logic, loops, and functions. It also
highlighted the importance of designing user-friendly interfaces and building
error-proof logic to handle real-world scenarios.

Although this project is a basic prototype, it provides a solid foundation for


further enhancement. With additional features such as file handling, user
registration, multiple buses, and payment gateways, this system could be
transformed into a complete commercial application.

Overall, the project achieves its primary objective of providing a functional,


console-based bus reservation solution and serves as a strong learning tool for
beginner programmers.
Reference

1. Programming in ANSI C – E. Balagurusamy


(For understanding C programming basics, functions, and control structures)

2. Let Us C – Yashavant Kanetkar


(For deepening knowledge on arrays, user-defined functions, and input/output
handling)

3. Online C Programming Tutorials – GeeksforGeeks, TutorialsPoint


(https://www.geeksforgeeks.org/c-programming-language/)
(https://www.tutorialspoint.com/cprogramming/index.htm)

4. YouTube Tutorials – ProgrammingKnowledge, CodeWithHarry


(For video-based guidance on building mini projects in C)

5. Sample mini projects and source code repositories from:

https://www.sourcecodester.com/

https://github.com/

You might also like