





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















SR. NO. CONTENT PAGE NO. 1 INTRODUCTION 1 2 WORK FLOW 2 3 HEADER FILES 3 4 CLASSES AND OBJECTS 4 5 FUNCTIONS 5 6 SOURCE CODE 6 ā 19 (^7) OUTPUT 20 ā 24 8 BIBLIOGRAPHY 25
INTRODUCTION The project is on Supermarket Billing. Supermarket is the place where customers come to purchase their daily using products and pay for that. 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.
HEADER FILES
CLASSES AND OBJECTS
SOURCE CODE //*************************************************************** // 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<<"\n\nPlease 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;}
// function to read all records from file //**************************************************************** void display_all() { clrscr(); cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n"; fp.open("Shop.dat",ios::in); while(fp.read((char*)&pr,sizeof(product))) { pr.show_product(); cout<<"\n
n====================================\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<<"\n\nrecord not exist"; getch(); } //*************************************************************** // function to modify record of file //****************************************************************
// function to delete record of file //**************************************************************** void delete_product() { int no; clrscr(); cout<<"\n\n\n\tDelete Record"; cout<<"\n\nPlease 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<<"\n\n\tRecord 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 OPEN\n\n\n Go To Admin Menu to create File"; cout<<"\n\n\n Program is closing....."; getch(); exit(0); } cout<<"\n\n\t\tProduct MENU\n\n";
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<<"\n\nThank You For Placing The Order";getch();clrscr(); cout<<"\n\n********************************INVOICE******************** ****\n"; cout<<"\nPr No.\tPr Name\tQuantity \tPrice \tAmount \tAmount after discount\n"; 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-(amtpr.retdis()/100); cout<<"\n"<<order_arr[x]<<"\t"<<pr.retname()<<"\t"<<quan[x]<<"\t\t"<<p r.retprice()<<"\t"<<amt<<"\t\t"<<damt; total+=damt; } fp.read((char)&pr,sizeof(product));
fp.close(); } cout<<"\n\n\t\t\t\t\tTOTAL = "<<total; getch(); } //*************************************************************** // INTRODUCTION FUNCTION //**************************************************************** void intro() { clrscr(); gotoxy(31,11); cout<<"SUPER MARKET BILLING PROJECT"; gotoxy(35,17); cout<<"\n\nDEVELOPED BY : RITESH KUMAR, DIPANSHU TYAGI,RISHABH MITTAL"; cout<<"\n\nSCHOOL : KENDRIYA VIDYALAYA NOIDA [SECOND SHIFT] "; getch(); } //*************************************************************** // ADMINSTRATOR MENU FUNCTION //**************************************************************** void admin_menu() {