Subject: Problem Solving using C Programming
Code: CSE-110
Semester: 1stSem Year: 2024 Section: A
Student Name Roll Number
B.ALOK KUMAR PATRO 202456051
KANHU CHARAN BEHERA 202456049
Title of the Project
SMART PARKING SYSTEM
Name of the Faculty: ASISH KUMAR DAS
Comment:
Mark obtained:
ABSTRACT: Smart Parking System Using C Language
The Smart Parking System is an innovative project aimed at addressing parking
management challenges in urban areas. The system is designed to optimize
parking space utilization, reduce congestion, and enhance user convenience.
Developed using the C programming language, the project simulates the
functioning of a smart parking lot by integrating features such as real-time
parking slot availability, vehicle registration, and billing management.
The system efficiently tracks occupied and vacant parking slots, ensuring users
can quickly locate a spot. It also provides automated calculations for parking
duration and corresponding charges. By employing structured programming and
data structures, this project demonstrates the practical implementation of
fundamental C concepts, including arrays, functions, and file handling, to create a
functional and user-friendly parking solution.
This project serves as a stepping stone for integrating software-driven solutions
into real-world parking management, contributing to smart city development and
sustainable urban mobility
OBJECTIVE:
Smart Parking System Project
To design a software-based parking management system using C language that
optimizes parking space utilization, reduces search time for slots, and automates
billing processes for improved user convenience and efficiency.
APPLICATIONS OF PROJECT:
Automated parking slot allocation and monitoring.
Real-time tracking of parking slot availability.
Efficient billing and payment calculation.
Deployment in malls, offices, and smart city projects.
NOVELTY OF PROJECT:
Cost-effective and lightweight solution using C language.
Scalable and customizable for larger facilities.
Reduces vehicle idle time, contributing to lower emissions.
LIST OF CONCEPTS USED :
Concepts Used in the Smart Parking System Project
1. Functions: Modularize the program for better readability and reusability.
2. Pointers: Efficient memory handling and dynamic data manipulation.
3. Recursive Functions: For tasks like searching or slot allocation algorithms.
4. Dynamic Memory Allocation: To handle variable-sized data structures during
runtime.
5. File Handling: For storing and retrieving data such as parking records and user
details.
6. Structures: To group related data such as vehicle details and parking slots.
7. Unions: To optimize memory usage where data overlap is required.
8. Arrays: For managing parking slot statuses and storing static data.
9. Strings: For handling vehicle registration numbers and user inputs.
10. Menu-Driven Program: To provide an interactive interface for users and
administrators.
11. Error Handling: Ensuring smooth program execution and handling invalid
inputs.
12. Sorting and Searching Algorithms: For efficient data management like finding
available slots.
These concepts showcase core programming principles while solving a real-
world problem effectively.
Description: Description of Smart Parking System Project
The Smart Parking System is designed to automate parking operations, such as
slot allocation, tracking occupancy, and billing. The project employs core
concepts of C programming to simulate a functional parking management system
with a menu-driven interface.
ALGORITHM:
1. Start
2. Display Menu Options:
Add Vehicle
Remove Vehicle
Check Slot Availability
View Parking Details
Exit
3. User Input for Menu Option:
If Add Vehicle:
Check for available slots.
If available:
Allocate slot and store vehicle details (registration number, time).
Update slot status to "occupied."
Else: Display "No slots available."
If Remove Vehicle:
Accept vehicle registration number.
Search in records.
If found:
Calculate parking duration and charges.
Mark slot as "vacant."
Delete vehicle details from records.
Else: Display "Vehicle not found."
If Check Slot Availability:
Display the number of vacant and occupied slots.
If View Parking Details:
Show all parked vehicles with slot numbers.
If Exit:
Save all records to a file and terminate the program.
4. Repeat Until Exit is Selected
5. End
FLOWCHART:
Step-by-Step Flowchart Overview
1. Start
Display the menu options.
2. User Input for Menu
If "Add Vehicle":
Check availability.
Allocate slot if available.
Update slot status and save details.
If "Remove Vehicle":
Search for vehicle.
Calculate charges and mark slot vacant.
If "Check Slot Availability":
Display vacant/occupied slots.
If "View Parking Details":
Display parked vehicle details.
If "Exit":
Save data and exit program.
3. Repeat Steps Until Exit is Chosen
4. End Program
CODE:-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_SLOTS 10
typedef struct {
int slotNumber;
char vehicleNumber[20];
int isOccupied;
} ParkingSlot;
ParkingSlot parkingSlots[MAX_SLOTS];
// Initialize Parking Slots
void initializeSlots() {
for (int i = 0; i < MAX_SLOTS; i++) {
parkingSlots[i].slotNumber = i + 1;
parkingSlots[i].isOccupied = 0;
strcpy(parkingSlots[i].vehicleNumber, "None");
}
// Display Parking Slots
void displaySlots() {
printf("\nSlot Status:\n");
printf("Slot\tVehicle Number\tStatus\n");
for (int i = 0; i < MAX_SLOTS; i++) {
printf("%d\t%s\t\t%s\n", parkingSlots[i].slotNumber,
parkingSlots[i].vehicleNumber,
parkingSlots[i].isOccupied ? "Occupied" : "Vacant");
// Add a Vehicle
void addVehicle() {
char vehicleNumber[20];
printf("Enter Vehicle Number: ");
scanf("%s", vehicleNumber);
for (int i = 0; i < MAX_SLOTS; i++) {
if (!parkingSlots[i].isOccupied) {
parkingSlots[i].isOccupied = 1;
strcpy(parkingSlots[i].vehicleNumber, vehicleNumber);
printf("Vehicle %s parked at slot %d.\n", vehicleNumber,
parkingSlots[i].slotNumber);
return;
}
printf("No available slots.\n");
// Remove a Vehicle
void removeVehicle() {
char vehicleNumber[20];
printf("Enter Vehicle Number to Remove: ");
scanf("%s", vehicleNumber);
for (int i = 0; i < MAX_SLOTS; i++) {
if (parkingSlots[i].isOccupied && strcmp(parkingSlots[i].vehicleNumber,
vehicleNumber) == 0) {
parkingSlots[i].isOccupied = 0;
strcpy(parkingSlots[i].vehicleNumber, "None");
printf("Vehicle %s removed from slot %d.\n", vehicleNumber,
parkingSlots[i].slotNumber);
return;
printf("Vehicle not found.\n");
// Main Menu
void menu() {
int choice;
do {
printf("\n--- Smart Parking System ---\n");
printf("1. Display Parking Slots\n");
printf("2. Add Vehicle\n");
printf("3. Remove Vehicle\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
displaySlots();
break;
case 2:
addVehicle();
break;
case 3:
removeVehicle();
break;
case 4:
printf("Exiting the system. Goodbye!\n");
break;
default:
printf("Invalid choice. Please try again.\n");
}
} while (choice != 4);
int main() {
initializeSlots();
menu();
return 0;
}
Outcome/Result: Smart Parking System Project
1. Efficient Parking Management: The system successfully allocates and
deallocates parking slots, ensuring optimal utilization of available spaces.
2. Real-Time Slot Monitoring: Users can check the current status of parking slots
(occupied or vacant) at any time.
3. Automated Processes: The project eliminates manual intervention by
automating slot allocation, vehicle tracking, and removal processes.
4. Billing Simulation: With additional enhancements, the system can calculate
parking charges based on duration, showcasing real-world applicability.
5. Interactive Interface: The menu-driven interface allows users to perform tasks
like adding and removing vehicles or checking parking status seamlessly.
6. Scalable Design: The project serves as a foundation for future enhancements,
such as integrating IoT, mobile apps, or dynamic pricing models.
7. Practical Learning: Demonstrates the application of C programming concepts
(functions, structures, arrays, file handling, pointers) to solve real-world
problems effectively.
Conclusion:
The Smart Parking System project provides a functional and reliable solution for
parking management, contributing to improved user experience and operational
efficiency in parking facilities.