You are on page 1of 38

CERTIFICATE

This is to certify that the

PROJECT “PATANJALI DEPARTMENTAL STORE


MANAGEMENT SYSTEM”

has been developed by

“xyz ” of class XII – A

under my supervision & guidance.


INDEX

S. Content Teacher’s
NO. Signature
1.
Acknowledgement

2. Introduction about the Project

3. Header files and their functions

4. Program coding

5. Outputs (all screens)

6. Bibliography
ACKNOWLEDGEMENT
“There are times when silence speaks so much more loudly than
words of praise to only as good as belittle a person, whose words
do not express, but only put a veneer over true feelings, which are
of gratitude at this point of time.”

I would like to sincerely thank all the people who helped and motivated me
throughout the project.
I would like to pay my gratitude to Mrs. (PGT Computer Science,
who with her keen insights and valuable feedback helped me to compile this
project. Without her assistance and encouragement this project would have not
been possible.
Special thanks to my parents, who actually helped me in all ways and their
support, pushed me to move further and further in this project.

-xyz
INTRODUCTION

Objective:-
To develop a C++project to manage a
Patanjali Departmental Store using object
oriented programming and data file
handling.

This is a project based on a Patanjali Departmental


StoreManagement. The program helps us to cover almost
all the aspects which are required to run a Departmental
Store.Moreover, it helps us to all the tasks taking
customer’s requirement of product in appropriate amounts.
The program helps us to take the basic information and
order of the customer after displaying the Menu to them. It
also helps us search any particular order based on the
choices made by the customer i.e. using Product’s
name/number .We can also modify any record of product
and delete records of particular products using
options/choices provided at the Shopkeeper’s menu.
It includes various function programs to do the above
mentioned tasks. Data file handling has been effectively
used in the program. This program uses the concept of
object-oriented programming and data file handling. The
database is a collection of interrelated data to serve multiple
applications. That is database programs create files of
information. So the program presented is uses data file
handling and object oriented programming to perform all the
actions and manage the cool ayurvedic departmental store.
HEADER FILES AND THEIR
FUNCTIONS
A header file is generally used to define all of the
functions, variables and constants contained in any function
library that you might want to use.

1.)#include<fstream.h>
It declares several useful library functions for performing
"console input and output" from a program. fstream is the
result of a multiple inheritance with ifstream and ofstream,
which both inherit from iostream. Its functions:
cin – used for input
cout– used for output
read( ) – used to read blocks of binary data
write( ) – used to write blocks of binary data
seekg( ) – let you to manipulate get pointer in the file
tellg () – retuns the position of getpointer in a file
stream.

2.)#include<conio.h>
It’s a C header file that declares several useful library
functions for performing "console input and output" from a
program, used mostly by MS dos compiler to provide
input/output. Its functions:
getch() – reads a character directly from console
without buffer

clrscr() – clear the screen

clreol() – clear the line

gotoxy()– gotoxy function places cursor at a desired


location on screen
3.)#include<process.h>
It’s a C header file which contains functions declarations
and macros used in working with threads and processes. Its
functions:
exit(0) – Close the program

4.)#include<stdio.h>
It defines one variable type, one macro, and various
functions for manipulating arrays of characters. Input and
output operations of strings can also be performed in C++.
Its functions:
gets( ) – get string from stream
puts( ) – write string from stream
5.)#include<string.h>
The library enables you to manipulate a string that end in
the character ‘\0’, the null character. Its functions:
strcmp(str1,str2) –returns an integer that is negative
is str1<str2,zero if str1==str2, positive if
. str1>str2
strcmpi(str1,str2) – behave like strcmp but ignores
case
strcpy(toS,fromS) –copies from fromS to toS
USER DEFINED
FUNCTIONS

A user-defined function (UDF) is a function provided by


the user of a program or environment, in a context where the
usual assumption is that functions are built into the program
or environment.

voidcreate() :- Function to create a new record of


Product by entering various values such as Product’s Number,
Product’s Name, Price of the Product and Discount on the
Product.

voiddisplayP() :- Function to display the entered values.

intretpno() :- Function to return Product Number of the


Product.
floatretprice() :- Function to return Price of the
Product.

char*retname() :- Function to return Name of the


Product.

intretdis() :- Function to return Discount on the Product.

voidwrite_product() :- Function to enter details of the


Product and storing that information in a binary file.

voiddisplay_all() :- Function to display all the entered


record of the Products.

voiddisplay_sp() :- Function to display a specific


Product by entering its details.

voidmodify_product() :- Function to modify a


record from the file.
voiddelete_product() :- Function to delete a record
from the file.

The Following Page Starts With the Coding


Of the C++ Coding Of
“Patanjali Store Billing Management System”
CODING
//---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------//

//=> PATANJALI STORE BILLING MANAGEMENT SYSTEM <=//

//---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------//

//************************* BY **************************//

//***************** SUMIT MEHTA ***************//

//************************ XII-A *************************//

//------------------------------------------------------------------------------------//

#include<conio.h> // ***************************

#include<stdio.h> // *** HEADER FILES USED*****

#include<process.h> // **** IN THE PROJECT ****

#include<fstream.h> // **************************

//********************************//

class product //*****<=== Class used in the Project //

{ //********************************//

int pno; //GLOBAL VARIABLES


char name[50]; // USED IN THE

float price,qty,tax,dis; // PROJECT

public:

void create(); //Function Prototype

void displayP(); // Declaration

int retpno() //<= Product Number of the Product

{ return pno; }

// MEMBER

float retprice() //<= Price of the Product

{ return price; } // FUNCTIONS

//

char* retname() //<= Name of the Product

{ return name; } // SUMIT MEHTA

int retdis() //<= Discount on the Product

{ return dis;}

}; // End of CLASS
//Global declaration for stream object and class object

fstream fp;

product pr;

void product::create() //Using SCOPE RESOLUTION OPERATOR (::

{ //Function to Input Values

cout<<"\n\n";

textcolor(21);

cprintf("Enter the Product No. of the Product : ");

cin>>pno;

cout<<"\n\n";

textcolor(43);

cprintf("Enter the Name of the Product : ");

gets(name);

cout<<"\n";

textcolor(13);

cprintf("Enter the Price of the Product : ");


cin>>price;

cout<<"\n";

textcolor(4);

cprintf("Enter the Discount (%) : ");

cin>>dis;

} //End of this function

void product::displayP()

cout<<"\n";

textcolor(9);

cprintf("The Product No. of the Product : ")<<pno;

cout<<"\n";

textcolor(21);

cprintf("The Name of the Product : ");//Function to Display Values

puts(name);

cout<<"\n";

textcolor(2);
cprintf("The Price of the Product : ");

cout<<price;

cout<<"\n";

textcolor(17);

cprintf("Discount : ");

cout<<dis; // The entered Values are

void write_product() //BY SUMIT MEHTA

fp.open("Shop.dat",ios::out|ios::app); //Opening the File in Stream

pr.create(); //Creating the file in Stream

fp.write((char*)&pr,sizeof(product)); //Finding size of File

fp.close(); // Closing the file in Stream

cout<<"\n\n";

textcolor(41);

cprintf("The Product has been CREATED");

getch();
} //End of this function

void display_all()

clrscr();

cout<<"\n\n\n\t\t";

textcolor(7);

cprintf("DISPLAY ALL RECORD !!!");

cout<<"\n\n";

fp.open("Shop.dat",ios::in); // Opening the File in Stream

while(fp.read((char*)&pr,sizeof(product)))// Reading from the file

pr.displayP(); //Displaying the Record by Calling the Function

cout<<"\n\n====================================\n";

getch(); //Function to Display all the Records

fp.close(); // Closing the File in Stream

getch();

}//End of this function


void display_sp(int n)

int flag=0;

fp.open("Shop.dat",ios::in); //Opening the File in Stream

while(fp.read((char*)&pr,sizeof(product))) //Reading from the File

{ //Function to Display

if(pr.retpno()==n) //Particular Product from the File

{ // ^ Checking the Product Number

clrscr();

pr.displayP(); //Calling the Display Function

flag=1;

fp.close(); //Closing the File in Stream

if(flag==0)

cout<<"\n\n";

textcolor(3);

cprintf("record not exist");

getch();

} //End of this function

// *BY*
// *SUMIT*

void modify_product() // *MEHTA*

int no,found=0;

clrscr();

cout<<"\n\n\t";

textcolor(7);

cprintf("To Modify ");//Function to Modify Specific Product from File

cout<<"\n\n\t";

textcolor(8);

cprintf("Please Enter The Product No. of The Product : ");

cin>>no;

fp.open("Shop.dat",ios::in|ios::out); //Opening File in Stream

while(fp.read((char*)&pr,sizeof(product)) && found==0)

{ //Checking the Product by Comparing from the Product Number

if(pr.retpno()==no)

pr.displayP(); //Calling the Display Function

cout<<"\n";
textcolor(29);

cprintf("Please Enter The New Details of Product");

cout<<endl;

pr.create(); //Calling the Create Function

int pos=-1*sizeof(pr);

fp.seekp(pos,ios::cur);

fp.write((char*)&pr,sizeof(product));//Writing newRecord

cout<<"\n\n\t";

textcolor(13);

cprintf("Record Updated");

found=1;

fp.close(); // Closing the File in Stream

if(found==0)

cout<<"\n\n";

textcolor(11);

cprintf("Record Not Found ");

getch();

}
void delete_product()

{ //Function to Delete a Record from the File

int no;

clrscr();

cout<<"\n\n\n\t";

textcolor(34);

cprintf("Delete Record");

cout<<"\n\n";

textcolor(5);

cprintf("Please Enter The product no. of The Product You Want To Delete : ");

cin>>no;

fp.open("Shop.dat",ios::in|ios::out);//Opening the File in Stream

fstream fp2; //Declaring Stream

fp2.open("Temp.dat",ios::out); //Opening Another File in Stream

fp.seekg(0,ios::beg); //Locating Begining of File

while(fp.read((char*)&pr,sizeof(product))) //Reading from file

{
if(pr.retpno()!=no) //Checking for Product Number

fp2.write((char*)&pr,sizeof(product)); //Writing in File

fp2.close(); // CLOSING

fp.close(); // THE FILE ## BY ##

remove("Shop.dat");//Deleting File ## SUMIT MEHTA ##

rename("Temp.dat","Shop.dat"); //Renaming File

cout<<"\n\n\t";

textcolor(17);

cprintf("Record Deleted ..");

getch();

}//End of this function

void menu()

{ //Function to Display all Products

clrscr(); //and their Price List

fp.open("Shop.dat",ios::in); //Opening the File in Stream

if(!fp)

{ textcolor(99);
cprintf("ERROR!!! FILE COULD NOT BE OPEN");

cout<<"\n\n\n";

textcolor(81);

cprintf("Go To Admin Menu to create File");

cout<<"\n\n\n";

textcolor(33);

cprintf("Program is closing ....");

getch();

exit(0);

cout<<"\n\n\t\t";

textcolor(44);

cprintf("Product MENU");

cout<<"\n\n";

cout<<"==================================================\n";

cout<<"P.NO.\t\tNAME\t\tPRICE\n";

cout<<"==================================================\n";
while(fp.read((char*)&pr,sizeof(product))) //Reading from the File

cout<<pr.retpno()<<"\t\t"<<pr.retname()<<"\t\t"<<pr.retprice()<<endl;

} //Returning Values

fp.close(); //Closing the File

} //End of this function

void place_order() //Function to Place an Order

int order_arr[50],quan[50],c=0; // LOCAL

float amt,damt,total=0; // VARIABLES

char ch='Y'; // Function to Generate Bill for the Products

menu();

cout<<"\n============================";

cout<<"\n PLACE YOUR ORDER";

cout<<"\n============================\n";

do{

cout<<"\n\n";
textcolor(42);

cprintf("Enter The Product No. Of The Product : ");

cin>>order_arr[c];

cout<<"\n";

textcolor(36);

cprintf("Quantity in number : ");

cin>>quan[c];

c++;

cout<<"\n";

textcolor(49);

cprintf("Do You Want To Order Another Product ? (y/n) : ");

cin>>ch;

while(ch=='y' ||ch=='Y');

cout<<"\n\n";

textcolor(31);

cprintf("Thank You For Placing The Order");

getch();
clrscr();

cout<<"\n\n******************INVOICE********************\n";

cout<<"\nPr No.\tPr Name\tQuantity \tPrice \tAmount \tNetAmount\n";

for(int x=0;x<=c;x++)

fp.open("Shop.dat",ios::in); //Opening the File in Stream

fp.read((char*)&pr,sizeof(product)); //Reading from File

while(!fp.eof())

if(pr.retpno()==order_arr[x])

amt=pr.retprice()*quan[x]; //Calculating Amount

damt=amt-(amt*pr.retdis()/100); //Calculating Discounted Amount

cout<<"\n"<<order_arr[x]<<"\t"<<pr.retname()<<"\t"<<quan[x]<<"\t\t";

cout<<pr.retprice()<<"\t"<<amt<<"\t\t"<<damt;

total+=damt; //Net Amount

fp.read((char*)&pr,sizeof(product));//Reading from File


}

fp.close(); //Closing the File

cout<<"\n\n\t\t\t\t\tTOTAL ="<<total;

getch();

}//End of this function

// ^^ B^Y^ ^^

void admin_menu() // ^^ S^U^M^I^T^ ^^

{ // ^^ M^E^H^T^A^ ^^

void main()

char ch;

clrscr();

cout<<"\n\n\n\n";

textcolor(CYAN + BLINK);

cprintf("*********************************************************");
cout<<"\t";

textcolor(5);

cprintf("PATANJALI"); // WELCOME SCREEN

cout<<"\t"; // SCREEN

textcolor(30); // OF MY

cprintf("STORE"); // PROJECT

cout<<"\t\t";

textcolor(25);

cprintf("BILLING");

cout<<"\t\t";

textcolor(35);

cprintf("MANAGEMENT");

cout<<"\t";

textcolor(45);

cprintf("SYSTEM");

cout<<"\n";
textcolor(CYAN + BLINK);

cprintf("*********************************************************");

cout<<"\n";

textcolor(29);

cprintf(" PrakritiKaAshirwad ");

textcolor(11);

cout<<"\n\n\n\n";

cprintf("GENUINELY DEVELOPED BY :SUMIT MEHTA");

textcolor(12);

cout<<"\n";

cprintf("SUBJECT TEACHER :Mrs.RUCHI CHHABRA");

textcolor(13);

cout<<"\n";

cprintf("SCHOOL :A.G.D.A.V. CENTENARY PUBLIC SCHOOL");

getch();
do

clrscr();

cout<<"\n\n\n";

textcolor(249);

cprintf("***********");

cout<<"\n";

cprintf("*USER MENU*");

cout<<"\n";

cprintf("***********");

cout<<"\n\n";

textcolor(3);

cprintf("1* CUSTOMER");

cout<<"\t";

textcolor(22);

cprintf("2* SHOPKEEPER");

cout<<"\t";

textcolor(25);
cprintf("3* EXIT"); //*****************************

cout<<"\n\n\n"; //* BY SUMIT MEHTA *

textcolor(2); //*****************************

cprintf("Please Select Your Option [1-3]");

ch=getche();

switch(ch)

case '1': clrscr();

place_order();//Calling the Function to Place Order

getch();

break;

case '2': clrscr();

char ch2;

cout<<"\n\t\t\t\t";

textcolor(34);

cprintf("SHOPKEEPER'S MENU");

cout<<"\n\n\t";

textcolor(45);
cprintf("1* CREATE A NEW PRODUCT");

cout<<"\t\t";

textcolor(12);

cprintf("2* DISPLAY ALL AVAILABLE PRODUCTS");

cout<<"\n\n\t";

textcolor(20);

cprintf("3* INQUIRY");

cout<<"\t\t\t";

textcolor(15);

cprintf("4* MODIFY EXISTING PRODUCT");

cout<<"\n\n\t";

textcolor(41);

cprintf("5* DELETE EXISTING PRODUCT");

cout<<"\t";

textcolor(11);

cprintf("6* VIEW PRODUCT MENU");

cout<<"\n\n\t";
textcolor(19);

cprintf("7* BACK TO PEVIOUS MENU");

cout<<"\n\n\n\n\n\n\n\t";

textcolor(50);

cprintf("Please Enter Your Choice [1-7] : ");

ch2=getche();

switch(ch2) //Shopkeeper's Menu Function

case '1': clrscr();

write_product();//Calling to Write a Product

break;

case '2': display_all();

break; //Calling to Function to Display the Records

case '3':

int num;

clrscr();

cout<<"\n\n\t";
textcolor(33);

cprintf("Enter the Product No. : ");

cin>>num;

display_sp(num);//Function to Display Product

break;

case '4': modify_product();

break; // <= Function to Modify Product

case '5': delete_product();

break; // <= Function to Delete Product

case '6': menu();

getch();

case '7':break; //<= The main function

default : cout<<"\a";admin_menu(); // of the program

} break;

case '3':exit(0);
default :cout<<"\a";

}while(ch!='3'); // ## Project ends here ##

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

// ^ Made by SUMIT MEHTA ^

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
BIBLIOGRAPHY

 Mrs. RuchiChhabra

 COMPUTER SCIENCE C++ CLASS XII


PINKI GUPTA (S.CHAND)

 COMPUTER SCIENCE C++ CLASS XII


SUMITA ARORA

 www.wikipedia.com

 www.c++tutorialclassics.com

 www.google.com

You might also like