C++ Project File
C++ Project File
ELDECO, LUCKNOW
(SESSION 2016-17)
MADE BY:
FARHAN KHAN
XII-D
TABLE OF CONTENTS
CERTIFICATE
ACKNOWLEDGEMENT
REQUIREMENTS
1
INTRODUCTION
HEADER FILES USED
SOURCE CODE
OUTPUT
FEASIBILITY
BIBLIOGRAPHY
2
DELHI PUBLIC SCHOOL
ELDECO, LUCKNOW
Signature Signature
Delhi Public School, Eldeco Lucknow. Delhi Public School, Eldeco Lucknow
Date………………………..
ACKNOWLEDGEMENT
I would like to express my sincere gratitude towards my computer science teacher
Mr.Rohit Chandra, for his vital support, guidance and encouragement- without which this
project would not have come forth. I would also like to express my gratitude to the
school for letting me use the school’s computer laboratory.
3
FARHAN KHAN
REQUIREMENTS
Minimum requirements are:
Min 64 Mb RAM
Min 60 Mb free disk for files
Min 48 Mb RAM at workstation
Printer- To print the documents of the project
Compact disk
4
Minimum software requirements:
Windows XP or above
Turbo C++ -for execution of program
Ms Word- for presentation of output
INTRODUCTION
My program implements the billing procedure used in
supermarkets.Supermarkets in all big cities require fast billing procedure for
the fast flow of customers in order to obtain maximum sales and profits.
Product Number
Product Name
Price
Discount
Create_product()
5
Show_product()
Write_product()
Display_all()
Modify_product()
Delete_product()
Place_order()
Admin_menu()
Intro()
6
HEADER FILES USED
7
SOURCE CODE
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
class product
int pno;
char name[50];
float price,qty,dis,tax;
public:
void create_product()
cin>>pno;
gets(name);
cin>>price;
8
cout<<"\nEnter the discount if any: ";
cin>>dis;
void show_product()
puts(name);
cout<<"\nDiscount : "<<dis<<"\n";
int retpno()
{return pno;
float retprice()
{return price;
char* retname()
{return name;
int retdis()
{return dis;
9
}
fstream file;
product pr;
void write_product()
file.open("Shop.dat",ios::out|ios::app);
pr.create_product();
file.write((char*)&pr,sizeof(product));
file.close();
getch();
void display_all()
clrscr();
file.open("Shop.dat",ios::in);
while(file.read((char*)&pr,sizeof(product)))
10
{
pr.show_product();
getch();
file.close();
getch();
void display_sp(int n)
int flag=0;
file.open("Shop.dat",ios::in);
while(file.read((char*)&pr,sizeof(product)))
if(pr.retpno()==n)
clrscr();
pr.show_product();
flag=1;
file.close();
if(flag==0)
getch();
11
}
void modify_product()
int no,match=0;
clrscr();
cout<<"\n\n\tPlease Enter The Product No. of The Product That You want to
modify";
cin>>no;
file.open("Shop.dat",ios::in|ios::out);
if(pr.retpno()==no)
pr.show_product();
pr.create_product();
int pos=-1*sizeof(pr);
file.seekp(pos,ios::cur);
file.write((char*)&pr,sizeof(product));
match=1;
12
}
file.close();
if(match==0)
getch();
void delete_product()
int no;
clrscr();
cout<<"\n\n\n\tDelete Record";
cin>>no;
file.open("Shop.dat",ios::in|ios::out);
fstream file2;
file2.open("New.dat",ios::out);
file.seekg(0,ios::beg);
while(file.read((char*)&pr,sizeof(product)))
13
if(pr.retpno()!=no)
file2.write((char*)&pr,sizeof(product));
file2.close();
file.close();
remove("Shop.dat");
rename("New.dat","Shop.dat");
getch();
void menu()
clrscr();
file.open("Shop.dat",ios::in);
if(!file)
getch();
exit(0);
14
}
cout<<"\n\n\t\tPRODUCT DETAILS\n\n";
cout<<"================================================
====\n";
cout<<"P.NO\t\tNAME\t\t\t\tPRICE\n";
cout<<"================================================
====\n";
while(file.read((char*)&pr,sizeof(product)))
{cout<<pr.retpno()<<"\t\t"<<pr.retname()<<"\t\t\t\
t"<<pr.retprice()<<endl;
file.close();
void place_order()
int order_arr[50],quan[50],i=0;
float amt,damt,total=0;
char ch='Y';
menu();
15
cout<<"\n PLACE YOUR ORDER";
do
cin>>order_arr[i];
cout<<"\nQuantity : ";
cin>>quan[i];
i++;
cin>>ch;
}while(ch=='y' ||ch=='Y');
getch();
clrscr();
cout<<"\t\t\tBILL";
for(int j=0;j<=i;j++)
file.open("Shop.dat",ios::in);
file.read((char*)&pr,sizeof(product));
while(!file.eof())
{if(pr.retpno()==order_arr[j])
{amt=pr.retprice()*quan[j];
damt=amt-(amt*pr.retdis()/100);
cout<<"\n"<<order_arr[j]<<"\t"<<pr.retname()<<"\t\t"<<quan[j]<<"\
t"<<pr.retprice()<<"\t"<<amt<<"\t"<<damt;
16
total+=damt;
file.read((char*)&pr,sizeof(product));
file.close();
cout<<"\n\n\t\t\t\t\tTOTAL = "<<total;
getch();
// MAIN PAGE//
void intro()
clrscr();
gotoxy(20,11);
gotoxy(22,14);
gotoxy(35,17);
cout<<"PROJECT";
getch();
// ADMINISTRATOR MENU//
void admin_menu()
17
{
clrscr();
char ch2;
cout<<"\n\n\n\tADMINISTRATOR MENU";
cout<<"\n\n\t1.CREATE PRODUCT";
ch2=getche();
switch(ch2)
write_product();
break;
break;
clrscr();
cin>>num;
display_sp(num);
break;
break;
18
case '5': delete_product();
break;
getch();
default : cout<<"\a";
admin_menu();
void main()
char ch;
intro();
do
clrscr();
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t2.ADMINISTRATOR MENU";
cout<<"\n\n\t3.EXIT";
ch=getche();
switch(ch)
19
{
place_order();
getch();
break;
break;
default : cout<<"\a";
}while(ch!='3');
// END OF PROGRAM//
OUTPUT
20
21
22
23
24
BIBLIOGRAPHY
25
References have been taken from the following sources
26