0% found this document useful (0 votes)
11 views15 pages

Data Structures

The document outlines a laboratory project titled 'Product Catalog Management System' developed by students at Mahatma Gandhi Institute of Technology. The system, implemented in C, utilizes linked lists for efficient management of product records, allowing users to add, display, search, and delete products dynamically. It serves as a foundational tool for inventory management and offers potential for future enhancements such as sorting and file storage.
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)
11 views15 pages

Data Structures

The document outlines a laboratory project titled 'Product Catalog Management System' developed by students at Mahatma Gandhi Institute of Technology. The system, implemented in C, utilizes linked lists for efficient management of product records, allowing users to add, display, search, and delete products dynamically. It serves as a foundational tool for inventory management and offers potential for future enhancements such as sorting and file storage.
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

Product Catalog Management System

A Laboratory Project Submitted


BY
ASPARI YASWANTH REDDY(23261A3203)
MANAPATI NAGA VAMSHI (23261A3234)
Under The Esteemed Guidance
of

Mrs. VARALAKSHMI
Assistant Professor

Department Of Information Technology


MAHATMA GANDHI INSTITUTE OF TECHNOLOGY
(Autonomous)
Chaitanya Bharathi P.O., Gandipet, Hydrebad-500075
2024-25
CERTIFICATE

This is to certify that the laboratory project ‘Product Catalog


ManagementSystem’ has been submitted by ASPARI YASWANTH
REDDY(23261A3203),MANAPATI NAGA VAMSHI (23261A3234) to the department
of Information Technology, Mahatma Gandhi Institute of Technology for Btech
III-sem Engineering, DATA STRUCTURES LABORATORY course during the
academic year 2024-25.

892

Project Guide:

Mrs.
VARALAKSHMI
Assistant professor
Dept of IT

DECLARATION

We hereby declare that the project entitled “Product Catalog Management System
” is original and Bonafide work carried out by us as a part of fulfilment for
Bachelor of Technology, III semester in Information Technology, Mahatma
Gandhi Institute of Technology, Gandipet, Hyderabad, under the guidance of
Mrs. Varalakshmi, Assistant Professor, dept of IT, MGIT.

ASPARI YASWANTH REDDY(23261A3203)


MANAPATI NAGA VAMSHI (23261A3234)

INDEX

[Link] TOPIC [Link]

1 Abstract 5
2 Introduction 6

3 Program 7-11
4 Output 12-13

5 Conclusion 14

6 References 15

ABSTRACT

The Product Catalog Management System is a dynamic and efficient


solution for managing product records in a digital catalog. Implemented
using the C programming language, this system leverages the power of data
structures, particularly linked lists, to store, retrieve, and manipulate
product data. The catalog supports essential operations, including adding
new products with unique IDs, names, and prices, displaying the list of all
products, searching for specific products by their ID, and deleting products
when no longer required.
This system is designed to optimize memory usage through dynamic
allocation, ensuring scalability and adaptability for catalogs of varying
sizes. By employing modular functions, the program ensures code clarity,
maintainability, and ease of extension for future enhancements.
Key features include:
1. Dynamic Product Management: Add, display, search, and delete
products efficiently.
2. Scalability: Linked list implementation allows for seamless expansion
of the catalog.
3. User-Friendly Interface: Console-based menu system ensures ease of
use.
This system can serve as a foundational tool for inventory management in
retail, e-commerce, and small business applications. Future enhancements
could include sorting products, saving the catalog to external files, or
integrating advanced data structures like hash tables for faster search
operations.

INTRODUCTION

In the modern era, efficient management of product information is


essential for businesses to maintain smooth operations, particularly in
domains such as retail, e-commerce, and inventory systems.
The Product Catalog Management System provides a basic yet
powerful framework to organize, retrieve, and manage product data
systematically. Developed in the C programming language, the system
utilizes dynamic memory allocation and linked lists, making it both
memory-efficient and scalable.
This project offers a menu-driven interface, allowing users to perform
core operations such as adding new products, displaying all available
products, searching for specific products by their unique ID, and
deleting records when needed. Each product is stored with attributes
such as ID, name, and price, ensuring the flexibility to accommodate
varying use cases.
The design philosophy of the system prioritizes modularity,
simplicity, and extensibility, making it suitable for beginners to
understand fundamental data structures while offering a practical
solution for small-scale applications. The linked list implementation
enables dynamic catalog growth, ensuring optimal performance even
as the dataset increases.
The Product Catalog Management System serves as an excellent
starting point for integrating additional functionalities such as product
sorting, file-based storage for persistence, and advanced search
capabilities, paving the way for more complex and versatile inventory
systems in the future.

CODE
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

// Define the structure for a product


typedef struct Product {

int id;

char name[50];

float price;

struct Product* next;

} Product;

// Function prototypes

void addProduct(Product** head, int id, char* name, float price);

void displayProducts(Product* head);

Product* searchProduct(Product* head, int id);

void deleteProduct(Product** head, int id);

int main() {

Product* catalog = NULL; // Head of the linked list

int choice, id;

char name[50];

float price;

do {

printf("\n--- Product Catalog System ---\n");

printf("1. Add Product\n");

printf("2. Display All Products\n");

printf("3. Search Product by ID\n");

printf("4. Delete Product by ID\n");

printf("5. Exit\n");

printf("Enter your choice: ");

scanf("%d", &choice);

switch (choice) {

case 1:

printf("Enter Product ID: ");

scanf("%d", &id);

printf("Enter Product Name: ");

scanf("%s", name);

printf("Enter Product Price: ");


scanf("%f", &price);

addProduct(&catalog, id, name, price);

break;

case 2:

displayProducts(catalog);

break;

case 3:

printf("Enter Product ID to search: ");

scanf("%d", &id);

Product* found = searchProduct(catalog, id);

if (found) {

printf("Product Found: ID=%d, Name=%s, Price=%.2f\n", found->id, found->name, found->price);

} else {

printf("Product not found!\n");

break;

case 4:

printf("Enter Product ID to delete: ");

scanf("%d", &id);

deleteProduct(&catalog, id);

break;

case 5:

printf("Exiting...\n");

break;

default:

printf("Invalid choice. Please try again.\n");

} while (choice != 5);

return 0;

// Function to add a new product to the catalog

void addProduct(Product** head, int id, char* name, float price) {

Product* newProduct = (Product*)malloc(sizeof(Product));

newProduct->id = id;
strcpy(newProduct->name, name);

newProduct->price = price;

newProduct->next = NULL;

// Insert at the end of the list

if (*head == NULL) {

*head = newProduct;

} else {

Product* temp = *head;

while (temp->next != NULL) {

temp = temp->next;

temp->next = newProduct;

printf("Product added: ID=%d, Name=%s, Price=%.2f\n", id, name, price);

// Function to display all products in the catalog

void displayProducts(Product* head) {

if (head == NULL) {

printf("No products in the catalog.\n");

return;

printf("\n--- Product Catalog ---\n");

Product* temp = head;

while (temp != NULL) {

printf("ID=%d, Name=%s, Price=%.2f\n", temp->id, temp->name, temp->price);

temp = temp->next;

// Function to search for a product by ID

Product* searchProduct(Product* head, int id) {

Product* temp = head;


while (temp != NULL) {

if (temp->id == id) {

return temp;

temp = temp->next;

return NULL;

// Function to delete a product by ID

void deleteProduct(Product** head, int id) {

Product* temp = *head;

Product* prev = NULL;

// If the product to be deleted is the head

if (temp != NULL && temp->id == id) {

*head = temp->next;

free(temp);

printf("Product with ID=%d deleted.\n", id);

return;

// Search for the product to delete

while (temp != NULL && temp->id != id) {

prev = temp;

temp = temp->next;

// If product not found

if (temp == NULL) {

printf("Product with ID=%d not found.\n", id);

return;

// Unlink the node and free memory

prev->next = temp->next;
free(temp);

printf("Product with ID=%d deleted.\n", id);

OUTPUT
Conclusion:
Product Catalog Management System
The Product Catalog Management System provides a simple yet
effective solution for organizing and managing product data using
fundamental concepts of the C programming language. Through the
use of linked lists, the system dynamically handles data, enabling
seamless addition, retrieval, and deletion of products without
predefined size limitations. This makes the program both scalable and
memory-efficient.
With its modular design and user-friendly menu interface, the system
is easy to use and understand, making it an ideal project for students
and professionals seeking to enhance their knowledge of data
structures and memory management. The system's ability to handle
core functionalities like searching for products by ID and dynamically
managing a growing catalog showcases the practical applications of
linked lists in real-world scenarios.
This project also lays a foundation for further development. Features
such as sorting, file integration for persistent storage, or even the use
of more advanced data structures could significantly enhance the
system's utility. In its current state, the Product Catalog Management
System demonstrates the power and flexibility of programming with
data structures, offering a practical tool for small-scale inventory and
product management applications.
REFERENCES
1. Class Notes
2. GeeksForGeeks
3. YouTube
[Link]

You might also like