SlideShare a Scribd company logo
This is a sample C++ Supermarket Billing Project for class 12 CBSE board. Select this program
and save as .cpp file and compile it on Turbo C++.
//***************************************************************
// HEADER FILE USED IN PROJECT
//****************************************************************
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
//***************************************************************
// CLASS USED IN PROJECT
//****************************************************************
class product
{
int pno;
char name[50];
float price,qty,tax,dis;
public:
void create_product()
{
cout<<"nPlease Enter The Product No. of The Product ";
cin>>pno;
cout<<"nnPlease Enter The Name of The Product ";
gets(name);
cout<<"nPlease Enter The Price of The Product ";
cin>>price;
cout<<"nPlease Enter The Discount (%) ";
cin>>dis;
}
void show_product()
{
cout<<"nThe Product No. of The Product : "<<pno;
cout<<"nThe Name of The Product : ";
puts(name);
cout<<"nThe Price of The Product : "<<price;
cout<<"nDiscount : "<<dis;
}
int retpno()
{return pno;}
float retprice()
{return price;}
char* retname()
{return name;}
int retdis()
{return dis;}
}; //class ends here

//***************************************************************
// global declaration for stream object, object
//****************************************************************
fstream fp;
product pr;
//***************************************************************
// function to write in file
//****************************************************************
void write_product()
{
fp.open("Shop.dat",ios::out|ios::app);
pr.create_product();
fp.write((char*)&pr,sizeof(product));
fp.close();
cout<<"nnThe Product Has Been Created ";
getch();
}
//***************************************************************
// function to read all records from file
//****************************************************************
void display_all()
{
clrscr();
cout<<"nnnttDISPLAY ALL RECORD !!!nn";
fp.open("Shop.dat",ios::in);
while(fp.read((char*)&pr,sizeof(product)))
{
pr.show_product();
cout<<"nn====================================n";
getch();
}
fp.close();
getch();
}
//***************************************************************
// function to read specific record from file
//****************************************************************
void display_sp(int n)
{
int flag=0;
fp.open("Shop.dat",ios::in);
while(fp.read((char*)&pr,sizeof(product)))
{
if(pr.retpno()==n)
{
clrscr();
pr.show_product();
flag=1;
}
}
fp.close();
if(flag==0)
cout<<"nnrecord not exist";
getch();
}
//***************************************************************
// function to modify record of file
//****************************************************************
void modify_product()
{
int no,found=0;
clrscr();
cout<<"nntTo Modify ";
cout<<"nntPlease Enter The Product No. of The Product";
cin>>no;
fp.open("Shop.dat",ios::in|ios::out);
while(fp.read((char*)&pr,sizeof(product)) && found==0)
{
if(pr.retpno()==no)
{
pr.show_product();
cout<<"nPlease Enter The New Details of Product"<<endl;
pr.create_product();
int pos=-1*sizeof(pr);
fp.seekp(pos,ios::cur);
fp.write((char*)&pr,sizeof(product));
cout<<"nnt Record Updated";
found=1;
}
}
fp.close();
if(found==0)
cout<<"nn Record Not Found ";
getch();
}
//***************************************************************
// function to delete record of file
//****************************************************************
void delete_product()
{
int no;
clrscr();
cout<<"nnntDelete Record";
cout<<"nnPlease Enter The product no. of The Product You Want To Delete";
cin>>no;
fp.open("Shop.dat",ios::in|ios::out);
fstream fp2;
fp2.open("Temp.dat",ios::out);
fp.seekg(0,ios::beg);
while(fp.read((char*)&pr,sizeof(product)))
{
if(pr.retpno()!=no)
{
fp2.write((char*)&pr,sizeof(product));
}
}
fp2.close();
fp.close();
remove("Shop.dat");
rename("Temp.dat","Shop.dat");
cout<<"nntRecord Deleted ..";
getch();
}
//***************************************************************
// function to display all products price list
//****************************************************************
void menu()
{
clrscr();
fp.open("Shop.dat",ios::in);
if(!fp)
{
cout<<"ERROR!!! FILE COULD NOT BE OPENnnn Go To Admin Menu to create
File";
cout<<"nnn Program is closing ....";
getch();
exit(0);
}
cout<<"nnttProduct MENUnn";
cout<<"====================================================n";
cout<<"P.NO.ttNAMEttPRICEn";
cout<<"====================================================n";
while(fp.read((char*)&pr,sizeof(product)))
{
cout<<pr.retpno()<<"tt"<<pr.retname()<<"tt"<<pr.retprice()<<endl;
}
fp.close();
}

//***************************************************************
// function to place order and generating bill for Products
//****************************************************************
void place_order()
{
int order_arr[50],quan[50],c=0;
float amt,damt,total=0;
char ch='Y';
menu();
cout<<"n============================";
cout<<"n PLACE YOUR ORDER";
cout<<"n============================n";
do{
cout<<"nnEnter The Product No. Of The Product : ";
cin>>order_arr[c];
cout<<"nQuantity in number : ";
cin>>quan[c];
c++;
cout<<"nDo You Want To Order Another Product ? (y/n)";
cin>>ch;
}while(ch=='y' ||ch=='Y');
cout<<"nnThank You For Placing The Order";getch();clrscr();
cout<<"n
n********************************INVOICE************************n";
cout<<"nPr No.tPr NametQuantity tPrice tAmount tAmount after
discountn";
for(int x=0;x<=c;x++)
{
fp.open("Shop.dat",ios::in);
fp.read((char*)&pr,sizeof(product));
while(!fp.eof())
{
if(pr.retpno()==order_arr[x])
{
amt=pr.retprice()*quan[x];
damt=amt-(amt*pr.retdis()/100);
cout<<"n"<<order_arr[x]<<"t"<<pr.retname()
<<"t"<<quan[x]<<"tt"<<pr.retprice()<<"t"<<amt<<"tt"<<damt;
total+=damt;
}
fp.read((char*)&pr,sizeof(product));
}
fp.close();
}
cout<<"nntttttTOTAL = "<<total;
getch();
}
//***************************************************************
// INTRODUCTION FUNCTION
//****************************************************************
void intro()
{
clrscr();
gotoxy(31,11);
cout<<"SUPER MARKET";
gotoxy(35,14);
cout<<"BILLING";
gotoxy(35,17);
cout<<"PROJECT";
cout<<"nnMADE BY : ANUJ KUMAR";
cout<<"nnSCHOOL : RYAN INTERNATIONAL SCHOOL";
getch();
}

//***************************************************************
// ADMINSTRATOR MENU FUNCTION
//****************************************************************
void admin_menu()
{
clrscr();
char ch2;
cout<<"nnntADMIN MENU";
cout<<"nnt1.CREATE PRODUCT";
cout<<"nnt2.DISPLAY ALL PRODUCTS";
cout<<"nnt3.QUERY ";
cout<<"nnt4.MODIFY PRODUCT";
cout<<"nnt5.DELETE PRODUCT";
cout<<"nnt6.VIEW PRODUCT MENU";
cout<<"nnt7.BACK TO MAIN MENU";
cout<<"nntPlease Enter Your Choice (1-7) ";
ch2=getche();
switch(ch2)
{
case '1': clrscr();
write_product();
break;
case '2': display_all();break;
case '3':
int num;
clrscr();
cout<<"nntPlease Enter The Product No. ";
cin>>num;
display_sp(num);
break;
case '4': modify_product();break;
case '5': delete_product();break;
case '6': menu();
getch();
case '7': break;
default:cout<<"a";admin_menu();
}
}
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
void main()
{
char ch;
intro();
do
{
clrscr();
cout<<"nnntMAIN MENU";
cout<<"nnt01. CUSTOMER";
cout<<"nnt02. ADMINISTRATOR";
cout<<"nnt03. EXIT";
cout<<"nntPlease Select Your Option (1-3) ";
ch=getche();
switch(ch)
{
case '1': clrscr();
place_order();
getch();
break;
case '2': admin_menu();
break;
case '3':exit(0);
default :cout<<"a";
}
}while(ch!='3');
}
//***************************************************************
// END OF PROJECT

More Related Content

What's hot

Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
Dr Sukhpal Singh Gill
 
Store management along with output
Store management along with outputStore management along with output
Store management along with output
Anavadya Shibu
 
CANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHONCANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHON
vikram mahendra
 
Computer science project work
Computer science project workComputer science project work
Computer science project work
rahulchamp2345
 
computer science project
computer science projectcomputer science project
computer science project
Roshan Bastia
 
Library management
Library managementLibrary management
Library management
Vishnu Prasad
 
c++ project on restaurant billing
c++ project on restaurant billing c++ project on restaurant billing
c++ project on restaurant billing
Swakriti Rathore
 
Canteen management
Canteen managementCanteen management
Canteen management
Omkar Majukar
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
vikram mahendra
 
programming in C++ report
programming in C++ reportprogramming in C++ report
programming in C++ report
vikram mahendra
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
Mahender Boda
 
C Programming Storage classes, Recursion
C Programming Storage classes, RecursionC Programming Storage classes, Recursion
C Programming Storage classes, Recursion
Sreedhar Chowdam
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
Nithin Kumar,VVCE, Mysuru
 
Python: Basic Inheritance
Python: Basic InheritancePython: Basic Inheritance
Python: Basic Inheritance
Damian T. Gordon
 
Phone book with project report for BCA,MCA
Phone book with project report for BCA,MCAPhone book with project report for BCA,MCA
Phone book with project report for BCA,MCA
Sp Gurjar
 
Clean Code Principles
Clean Code PrinciplesClean Code Principles
Clean Code Principles
YeurDreamin'
 
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solutionLet us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Hazrat Bilal
 
C Programming Project
C Programming ProjectC Programming Project
C Programming Project
Vijayananda Mohire
 

What's hot (20)

Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Store management along with output
Store management along with outputStore management along with output
Store management along with output
 
Java practical
Java practicalJava practical
Java practical
 
CANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHONCANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHON
 
Computer science project work
Computer science project workComputer science project work
Computer science project work
 
computer science project
computer science projectcomputer science project
computer science project
 
Library management
Library managementLibrary management
Library management
 
c++ project on restaurant billing
c++ project on restaurant billing c++ project on restaurant billing
c++ project on restaurant billing
 
Canteen management
Canteen managementCanteen management
Canteen management
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
 
programming in C++ report
programming in C++ reportprogramming in C++ report
programming in C++ report
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
 
C Programming Storage classes, Recursion
C Programming Storage classes, RecursionC Programming Storage classes, Recursion
C Programming Storage classes, Recursion
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
 
Python: Basic Inheritance
Python: Basic InheritancePython: Basic Inheritance
Python: Basic Inheritance
 
Phone book with project report for BCA,MCA
Phone book with project report for BCA,MCAPhone book with project report for BCA,MCA
Phone book with project report for BCA,MCA
 
Clean Code Principles
Clean Code PrinciplesClean Code Principles
Clean Code Principles
 
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solutionLet us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
 
C Programming Project
C Programming ProjectC Programming Project
C Programming Project
 

Viewers also liked

Project Super market billing system
Project Super market billing systemProject Super market billing system
Project Super market billing system
Vickey Mahant
 
The main purpose of the project is to manage the supermarket efficiently (rep...
The main purpose of the project is to manage the supermarket efficiently (rep...The main purpose of the project is to manage the supermarket efficiently (rep...
The main purpose of the project is to manage the supermarket efficiently (rep...Rajesh Roky
 
Supermarkets
SupermarketsSupermarkets
Supermarkets
josemiguelmc
 
Super marketbillingsystemproject
Super marketbillingsystemprojectSuper marketbillingsystemproject
Super marketbillingsystemproject
Vickey Mahant
 
04.project billing system
04.project billing system04.project billing system
04.project billing systemgirivaishali
 
Power point presentation (grocery store)
Power point presentation (grocery store)Power point presentation (grocery store)
Power point presentation (grocery store)Alina Hacopian
 
Use case diagram abc supermarket workshop
Use case diagram abc supermarket workshopUse case diagram abc supermarket workshop
Use case diagram abc supermarket workshopskanduri
 
Billing System
Billing SystemBilling System
Billing Systemmd2gri
 
Designing Supermarket
Designing SupermarketDesigning Supermarket
Designing Supermarketglenferry
 
Extra Easy Supermarket Design
Extra Easy Supermarket Design Extra Easy Supermarket Design
Extra Easy Supermarket Design
Manav Shrivastav
 
Supermarket journal
Supermarket journalSupermarket journal
Supermarket journal
haitchypoo
 
Grocery Station- Database Management System Project
Grocery Station- Database Management System ProjectGrocery Station- Database Management System Project
Grocery Station- Database Management System Project
Tapan Desai
 
Synopsis on billing system
Synopsis on billing systemSynopsis on billing system
Synopsis on billing system
Alok Sharma
 
Super Market Management System
Super Market Management SystemSuper Market Management System
Super Market Management System
Shubham Singh
 
Supermarket Presentation
Supermarket Presentation Supermarket Presentation
Supermarket Presentation Favian Chua
 
A Complete Model of the Supermarket Business - Article
A Complete Model of the Supermarket Business - ArticleA Complete Model of the Supermarket Business - Article
A Complete Model of the Supermarket Business - Article
Frank Steeneken
 
Walmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABADWalmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABAD
viplove singh
 
Airline system ppt
Airline system ppt Airline system ppt
Airline system ppt
Sunil Thakur
 

Viewers also liked (20)

Project Super market billing system
Project Super market billing systemProject Super market billing system
Project Super market billing system
 
The main purpose of the project is to manage the supermarket efficiently (rep...
The main purpose of the project is to manage the supermarket efficiently (rep...The main purpose of the project is to manage the supermarket efficiently (rep...
The main purpose of the project is to manage the supermarket efficiently (rep...
 
Supermarkets
SupermarketsSupermarkets
Supermarkets
 
Super marketbillingsystemproject
Super marketbillingsystemprojectSuper marketbillingsystemproject
Super marketbillingsystemproject
 
C++ super market
C++ super marketC++ super market
C++ super market
 
04.project billing system
04.project billing system04.project billing system
04.project billing system
 
Power point presentation (grocery store)
Power point presentation (grocery store)Power point presentation (grocery store)
Power point presentation (grocery store)
 
Imtiaz super market
Imtiaz super marketImtiaz super market
Imtiaz super market
 
Use case diagram abc supermarket workshop
Use case diagram abc supermarket workshopUse case diagram abc supermarket workshop
Use case diagram abc supermarket workshop
 
Billing System
Billing SystemBilling System
Billing System
 
Designing Supermarket
Designing SupermarketDesigning Supermarket
Designing Supermarket
 
Extra Easy Supermarket Design
Extra Easy Supermarket Design Extra Easy Supermarket Design
Extra Easy Supermarket Design
 
Supermarket journal
Supermarket journalSupermarket journal
Supermarket journal
 
Grocery Station- Database Management System Project
Grocery Station- Database Management System ProjectGrocery Station- Database Management System Project
Grocery Station- Database Management System Project
 
Synopsis on billing system
Synopsis on billing systemSynopsis on billing system
Synopsis on billing system
 
Super Market Management System
Super Market Management SystemSuper Market Management System
Super Market Management System
 
Supermarket Presentation
Supermarket Presentation Supermarket Presentation
Supermarket Presentation
 
A Complete Model of the Supermarket Business - Article
A Complete Model of the Supermarket Business - ArticleA Complete Model of the Supermarket Business - Article
A Complete Model of the Supermarket Business - Article
 
Walmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABADWalmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABAD
 
Airline system ppt
Airline system ppt Airline system ppt
Airline system ppt
 

Similar to Supermarket

computer project on shopping mall..cbse 2017-2018 project
computer project on shopping mall..cbse 2017-2018 projectcomputer project on shopping mall..cbse 2017-2018 project
computer project on shopping mall..cbse 2017-2018 project
Róhït Ràút
 
~ Project-student report-card.cpp[1]
~ Project-student report-card.cpp[1]~ Project-student report-card.cpp[1]
~ Project-student report-card.cpp[1]Sunny Rekhi
 
Durgesh
DurgeshDurgesh
Durgesh
dkbossverma
 
File handling complete programs in c++
File handling complete programs in c++File handling complete programs in c++
File handling complete programs in c++
zain ul hassan
 
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
Supriya Radhakrishna
 
Sunil
SunilSunil
Week 2 - Advanced C++list1.txt312220131197.docx
Week 2 - Advanced C++list1.txt312220131197.docxWeek 2 - Advanced C++list1.txt312220131197.docx
Week 2 - Advanced C++list1.txt312220131197.docx
melbruce90096
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
ssuser454af01
 
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfC++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
rohit219406
 
Implementation of k-means clustering algorithm in C
Implementation of k-means clustering algorithm in CImplementation of k-means clustering algorithm in C
Implementation of k-means clustering algorithm in C
Kasun Ranga Wijeweera
 
Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493Azhar Satti
 
Library Management System in c++
Library Management System in c++Library Management System in c++
Library Management System in c++
vikram mahendra
 
Lab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docxLab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docx
DIPESH30
 
Computer
ComputerComputer
Computer
Gaurav Kumar
 
Project fast food automaton
Project fast food automatonProject fast food automaton
Project fast food automaton
varun arora
 
computer science c++ project class xii
computer science c++ project class xiicomputer science c++ project class xii
computer science c++ project class xii
Yogesh Saini
 
TYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase frameworkTYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase framework
Christian Trabold
 
C# Assignmet Help
C# Assignmet HelpC# Assignmet Help
C# Assignmet Help
Programming Homework Help
 
Library Managment System - C++ Program
Library Managment System - C++ ProgramLibrary Managment System - C++ Program
Library Managment System - C++ Program
Muhammad Danish Badar
 

Similar to Supermarket (20)

computer project on shopping mall..cbse 2017-2018 project
computer project on shopping mall..cbse 2017-2018 projectcomputer project on shopping mall..cbse 2017-2018 project
computer project on shopping mall..cbse 2017-2018 project
 
~ Project-student report-card.cpp[1]
~ Project-student report-card.cpp[1]~ Project-student report-card.cpp[1]
~ Project-student report-card.cpp[1]
 
Durgesh
DurgeshDurgesh
Durgesh
 
File handling complete programs in c++
File handling complete programs in c++File handling complete programs in c++
File handling complete programs in c++
 
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
 
Sunil
SunilSunil
Sunil
 
Week 2 - Advanced C++list1.txt312220131197.docx
Week 2 - Advanced C++list1.txt312220131197.docxWeek 2 - Advanced C++list1.txt312220131197.docx
Week 2 - Advanced C++list1.txt312220131197.docx
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
 
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfC++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
 
Implementation of k-means clustering algorithm in C
Implementation of k-means clustering algorithm in CImplementation of k-means clustering algorithm in C
Implementation of k-means clustering algorithm in C
 
Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493Qtp Training Deepti 4 Of 4493
Qtp Training Deepti 4 Of 4493
 
Library Management System in c++
Library Management System in c++Library Management System in c++
Library Management System in c++
 
Lab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docxLab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docx
 
Computer
ComputerComputer
Computer
 
Shopping mall
Shopping mallShopping mall
Shopping mall
 
Project fast food automaton
Project fast food automatonProject fast food automaton
Project fast food automaton
 
computer science c++ project class xii
computer science c++ project class xiicomputer science c++ project class xii
computer science c++ project class xii
 
TYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase frameworkTYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase framework
 
C# Assignmet Help
C# Assignmet HelpC# Assignmet Help
C# Assignmet Help
 
Library Managment System - C++ Program
Library Managment System - C++ ProgramLibrary Managment System - C++ Program
Library Managment System - C++ Program
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 

Supermarket

  • 1. This is a sample C++ Supermarket Billing Project for class 12 CBSE board. Select this program and save as .cpp file and compile it on Turbo C++. //*************************************************************** // HEADER FILE USED IN PROJECT //**************************************************************** #include<conio.h> #include<stdio.h> #include<process.h> #include<fstream.h> //*************************************************************** // CLASS USED IN PROJECT //**************************************************************** class product { int pno; char name[50]; float price,qty,tax,dis; public: void create_product() { cout<<"nPlease Enter The Product No. of The Product "; cin>>pno; cout<<"nnPlease Enter The Name of The Product "; gets(name); cout<<"nPlease Enter The Price of The Product "; cin>>price; cout<<"nPlease Enter The Discount (%) "; cin>>dis; } void show_product() { cout<<"nThe Product No. of The Product : "<<pno; cout<<"nThe Name of The Product : "; puts(name); cout<<"nThe Price of The Product : "<<price; cout<<"nDiscount : "<<dis; } int retpno() {return pno;} float retprice() {return price;} char* retname() {return name;} int retdis() {return dis;} }; //class ends here //*************************************************************** // global declaration for stream object, object //**************************************************************** fstream fp; product pr; //*************************************************************** // function to write in file //**************************************************************** void write_product() {
  • 2. fp.open("Shop.dat",ios::out|ios::app); pr.create_product(); fp.write((char*)&pr,sizeof(product)); fp.close(); cout<<"nnThe Product Has Been Created "; getch(); } //*************************************************************** // function to read all records from file //**************************************************************** void display_all() { clrscr(); cout<<"nnnttDISPLAY ALL RECORD !!!nn"; fp.open("Shop.dat",ios::in); while(fp.read((char*)&pr,sizeof(product))) { pr.show_product(); cout<<"nn====================================n"; getch(); } fp.close(); getch(); } //*************************************************************** // function to read specific record from file //**************************************************************** void display_sp(int n) { int flag=0; fp.open("Shop.dat",ios::in); while(fp.read((char*)&pr,sizeof(product))) { if(pr.retpno()==n) { clrscr(); pr.show_product(); flag=1; } } fp.close(); if(flag==0) cout<<"nnrecord not exist"; getch(); } //*************************************************************** // function to modify record of file //**************************************************************** void modify_product() { int no,found=0; clrscr(); cout<<"nntTo Modify "; cout<<"nntPlease Enter The Product No. of The Product"; cin>>no; fp.open("Shop.dat",ios::in|ios::out); while(fp.read((char*)&pr,sizeof(product)) && found==0) {
  • 3. if(pr.retpno()==no) { pr.show_product(); cout<<"nPlease Enter The New Details of Product"<<endl; pr.create_product(); int pos=-1*sizeof(pr); fp.seekp(pos,ios::cur); fp.write((char*)&pr,sizeof(product)); cout<<"nnt Record Updated"; found=1; } } fp.close(); if(found==0) cout<<"nn Record Not Found "; getch(); } //*************************************************************** // function to delete record of file //**************************************************************** void delete_product() { int no; clrscr(); cout<<"nnntDelete Record"; cout<<"nnPlease Enter The product no. of The Product You Want To Delete"; cin>>no; fp.open("Shop.dat",ios::in|ios::out); fstream fp2; fp2.open("Temp.dat",ios::out); fp.seekg(0,ios::beg); while(fp.read((char*)&pr,sizeof(product))) { if(pr.retpno()!=no) { fp2.write((char*)&pr,sizeof(product)); } } fp2.close(); fp.close(); remove("Shop.dat"); rename("Temp.dat","Shop.dat"); cout<<"nntRecord Deleted .."; getch(); } //*************************************************************** // function to display all products price list //**************************************************************** void menu() { clrscr(); fp.open("Shop.dat",ios::in); if(!fp) { cout<<"ERROR!!! FILE COULD NOT BE OPENnnn Go To Admin Menu to create File"; cout<<"nnn Program is closing ...."; getch();
  • 4. exit(0); } cout<<"nnttProduct MENUnn"; cout<<"====================================================n"; cout<<"P.NO.ttNAMEttPRICEn"; cout<<"====================================================n"; while(fp.read((char*)&pr,sizeof(product))) { cout<<pr.retpno()<<"tt"<<pr.retname()<<"tt"<<pr.retprice()<<endl; } fp.close(); } //*************************************************************** // function to place order and generating bill for Products //**************************************************************** void place_order() { int order_arr[50],quan[50],c=0; float amt,damt,total=0; char ch='Y'; menu(); cout<<"n============================"; cout<<"n PLACE YOUR ORDER"; cout<<"n============================n"; do{ cout<<"nnEnter The Product No. Of The Product : "; cin>>order_arr[c]; cout<<"nQuantity in number : "; cin>>quan[c]; c++; cout<<"nDo You Want To Order Another Product ? (y/n)"; cin>>ch; }while(ch=='y' ||ch=='Y'); cout<<"nnThank You For Placing The Order";getch();clrscr(); cout<<"n n********************************INVOICE************************n"; cout<<"nPr No.tPr NametQuantity tPrice tAmount tAmount after discountn"; for(int x=0;x<=c;x++) { fp.open("Shop.dat",ios::in); fp.read((char*)&pr,sizeof(product)); while(!fp.eof()) { if(pr.retpno()==order_arr[x]) { amt=pr.retprice()*quan[x]; damt=amt-(amt*pr.retdis()/100); cout<<"n"<<order_arr[x]<<"t"<<pr.retname() <<"t"<<quan[x]<<"tt"<<pr.retprice()<<"t"<<amt<<"tt"<<damt; total+=damt; } fp.read((char*)&pr,sizeof(product)); } fp.close(); } cout<<"nntttttTOTAL = "<<total;
  • 5. getch(); } //*************************************************************** // INTRODUCTION FUNCTION //**************************************************************** void intro() { clrscr(); gotoxy(31,11); cout<<"SUPER MARKET"; gotoxy(35,14); cout<<"BILLING"; gotoxy(35,17); cout<<"PROJECT"; cout<<"nnMADE BY : ANUJ KUMAR"; cout<<"nnSCHOOL : RYAN INTERNATIONAL SCHOOL"; getch(); } //*************************************************************** // ADMINSTRATOR MENU FUNCTION //**************************************************************** void admin_menu() { clrscr(); char ch2; cout<<"nnntADMIN MENU"; cout<<"nnt1.CREATE PRODUCT"; cout<<"nnt2.DISPLAY ALL PRODUCTS"; cout<<"nnt3.QUERY "; cout<<"nnt4.MODIFY PRODUCT"; cout<<"nnt5.DELETE PRODUCT"; cout<<"nnt6.VIEW PRODUCT MENU"; cout<<"nnt7.BACK TO MAIN MENU"; cout<<"nntPlease Enter Your Choice (1-7) "; ch2=getche(); switch(ch2) { case '1': clrscr(); write_product(); break; case '2': display_all();break; case '3': int num; clrscr(); cout<<"nntPlease Enter The Product No. "; cin>>num; display_sp(num); break; case '4': modify_product();break; case '5': delete_product();break; case '6': menu(); getch(); case '7': break; default:cout<<"a";admin_menu(); } }
  • 6. //*************************************************************** // THE MAIN FUNCTION OF PROGRAM //**************************************************************** void main() { char ch; intro(); do { clrscr(); cout<<"nnntMAIN MENU"; cout<<"nnt01. CUSTOMER"; cout<<"nnt02. ADMINISTRATOR"; cout<<"nnt03. EXIT"; cout<<"nntPlease Select Your Option (1-3) "; ch=getche(); switch(ch) { case '1': clrscr(); place_order(); getch(); break; case '2': admin_menu(); break; case '3':exit(0); default :cout<<"a"; } }while(ch!='3'); } //*************************************************************** // END OF PROJECT