Certificate: Super Market Billing
Certificate: Super Market Billing
CERTIFICATE
NAME OF THE INSTITUTION : All Saints’ Public School and Junior College
PLACE : Adoor
ACKNOWLEDGEMENT
I would also like to thank my parents and my friends who helped me a lot in
finalizing this project within the limited time frame.
Index
S No. Program Page No.
1 C++ Overview
2 Introduction
3 System Requirements
4 Header Files used
5 Class and Objects used
6 Functions used
7 Program Code
8 Output
9 Bibliography
C++ OVERVIEW
C++ is a statistically typed , compiled , general – purpose, case –sensitive, free –
form programming language that supports procedural , object oriented, and generic
programming.
C++ was developed by Bjarne Stroustrap starting in 1979 at Bell Labs in Murray
Hill, New Jersey, as an enhancement to the C language and originally named C
with Classes but later it was renamed in 1983.
C++ is a superset of C, and that virtually any legal C program is a legal C++
program. C++ fully supports object-oriented programming, including the four
pillar of object –oriented development.
Encapsulation
Data hiding
Inheritance
Polymorphism
INTRODUCTION
The project is on Super market billing. Super Market is the place where customers
come to purchase their daily goods and pay for them. So there is a need to calculate
how many products are sold and to generate the bill for the customer.
In our project we have 2 users. First one is the administrator who will decide the
taxes and commissions on the products and can see the report of any product.
He is the one who will decide the products available for customers. The second one
is the customer or the billing manager who can purchase the items available or can
make the bill for the customers.
This project can also be used for online purchasing as the customer can access it
easily.
SYSTEM REQUIREMENTS
5. CD
3. LANGUAGE C LANGUAGE
4. VERSION TURBO C7
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
Product
OBJECTS
pr
FUNCTIONS USED
1.void create_product()
2.void show_product()
3.int retpno()
4. float retprice()
5. char retname()
6. int retdis()
7. void write_product()
8. pr create_product()
9. void display_all()
10. pr show_product()
11. void displaysp(int n)
12. void modify_product()
13. void delete_product()
14.void place_order
15. void intro()
16. void admin_menu()
Source code
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<stdio.h>
class product
int pr_no;
char name[30];
float price,qty;
public:
10 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
};
void product::main_menu()
int choice;
while(choice!=4)
clrscr();
cout<<"\n\t\t\t\t*************";
cout<<"\n\t\t\t\t*************";
cout<<"\n\n\n\t\t\t1.Add a product";
cout<<"\n\t\t\t2.Product Record";
cout<<"\n\t\t\t3.Edit Record";
cout<<"\n\t\t\t4.Exit";
cin>>choice;
switch(choice)
case 1: add();
11 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
break;
case 2: display();
break;
case 3: edit();
break;
case 4: break;
default:
cout<<"\n\n\t\t\tWrong choice!!!";
getch();
void product::add()
clrscr();
int r,flag;
ofstream fout("shop.dat",ios::app);
12 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
cout<<"\n **********************";
cin>>r;
flag=check(r);
if(flag)
else
pr_no=r;
gets(name);
cin>>price;
cin>>qty;
fout.write((char*)this,sizeof(product));
getch();
13 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
fout.close();
void product::display()
clrscr();
ifstream fin("shop.dat",ios::in);
int r,flag;
cin>>r;
while(!fin.eof())
fin.read((char*)this,sizeof(product));
if(pr_no==r)
clrscr();
cout<<"\n ****************";
flag=1;
break;
if(flag==0)
getch();
fin.close();
void product::edit()
clrscr();
int choice,r;
cout<<"\n *********";
cin>>choice;
clrscr();
cin>>r;
switch(choice)
case 1: modify(r);
break;
case 2: delete_rec(r);
break;
getch();
int product::check(int r)
int flag=0;
16 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
ifstream fin("shop.dat",ios::in);
while(!fin.eof())
fin.read((char*)this,sizeof(product));
if(pr_no==r)
flag=1;
break;
fin.close();
return(flag);
void product::modify(int r)
long pos,flag=0;
fstream file("shop.dat",ios::in|ios::out|ios::binary);
while(!file.eof())
{
17 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
pos=file.tellg();
file.read((char*)this,sizeof(product));
if(pr_no==r)
cout<<"\n *****************";
gets(name);
cin>>price;
cin>>qty;
file.seekg(pos);
file.write((char*)this,sizeof(product));
flag=1;
break;
if(flag==0)
file.close();
void product::delete_rec(int r)
int flag=0;
char ch;
ifstream fin("shop.dat",ios::in);
ofstream fout("temp1.dat",ios::out);
while(!fin.eof())
fin.read((char*)this,sizeof(product));
if(pr_no==r)
cin>>ch;
19 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
if(ch=='n')
fout.write((char*)this,sizeof(product));
flag=1;
else
fout.write((char*)this,sizeof(product));
fin.close();
fout.close();
if(flag==0)
else
remove("shop.dat");
rename("temp1.dat","shop.dat");
void main()
20 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
product h;
clrscr();
cout<<"\n\t\t\t******************************\n";
cout<<"\t\t\t******************************\n";
getch();
h.main_menu();
21 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
22 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
23 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
24 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
25 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
Bibliography
26 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E
SUPER MARKET BILLING
Text books
1. Computer science with C++(Sumita Arora)
Websites:
27 | A L L S A I N T S ’ P U B L I C S C H O O L A N D J U N I O R C O L L E G E