0% found this document useful (0 votes)
2 views

C++ Project File

.....

Uploaded by

Avyaan Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

C++ Project File

.....

Uploaded by

Avyaan Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

DELHI PUBLIC SCHOOL

ELDECO, LUCKNOW

(SESSION 2016-17)

COMPUTER SCIENCE (083)


CLASS XII
PROJECT FILE

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

This is to certify that…………………....................................of class XII has completed Computer

Science Project on the topic ……………………………………………………….as per CBSE guidelines.

Signature Signature

Dr. Deepti Dwivedi Mr. Rohit Chandra

Principal PGT Computer Science

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:

An Intel based processing unit capable of running any sort of windows


operating system such as Pentium based workstation.

Minimum hardware 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.

The user of the following program is a supermarket cashier.

Each product in the inventory has

 Product Number
 Product Name
 Price
 Discount

The functions used in the program are

Create_product()

Used to get the product details from the user

5
Show_product()

Displays the details of the created product

Write_product()

To write the details of the product on a inventory file

Display_all()

To display the details of all the products

Modify_product()

To modify the details of a specific product

Delete_product()

To delete the details of a product

Place_order()

To place an order of the customer

Admin_menu()

To display the administrator menu on the screen

Intro()

To display the main page of the program

6
HEADER FILES USED

 fstream.h- for file handling, cin and cout


 conio.h- for clrscr(),getch(),getche() functions
 stdio.h-for standard input output operations
 process.h-for exit() function

7
SOURCE CODE

The souce code of the supermarket billing program is as follows

#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()

cout<<"\nEnter the product no: ";

cin>>pno;

cout<<"\nEnter the product name: ";

gets(name);

cout<<"\nEnter the price: ";

cin>>price;

8
cout<<"\nEnter the discount if any: ";

cin>>dis;

void show_product()

cout<<"\nProduct No.: "<<pno;

cout<<"\nProduct Name : ";

puts(name);

cout<<"Product Price : "<<price;

cout<<"\nDiscount : "<<dis<<"\n";

int retpno()

{return pno;

float retprice()

{return price;

char* retname()

{return name;

int retdis()

{return dis;

9
}

};// END OF CLASS

fstream file;

product pr;

// FUNCTION FOR PRODUCT CREATION//

void write_product()

file.open("Shop.dat",ios::out|ios::app);

pr.create_product();

file.write((char*)&pr,sizeof(product));

file.close();

cout<<"\n\nThe Product Has Been Created ";

getch();

// FUNCTION TO DISPLAY ALL DETAILS//

void display_all()

clrscr();

cout<<"\n\n\n\t\tDISPLAYIG ALL THE RECORDS !!!\n\n";

file.open("Shop.dat",ios::in);

while(file.read((char*)&pr,sizeof(product)))

10
{

pr.show_product();

getch();

file.close();

getch();

// FUNCTION TO DISPLAY SPECIFIC PRODUCT DETAILS//

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)

cout<<"\n\nrecord not exist";

getch();

11
}

//FUNCTION TO MODIFY PRODUCT DETAILS//

void modify_product()

int no,match=0;

clrscr();

cout<<"\n\n\tTo Modify ";

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);

while(file.read((char*)&pr,sizeof(product)) && match==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);

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

file.write((char*)&pr,sizeof(product));

cout<<"\n\n\t Record Updated";

match=1;

12
}

file.close();

if(match==0)

{ cout<<"\n\n Record Not Found ";

getch();

//FUNCTION TO DELETE PRODUCT RECORD//

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;

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");

cout<<"\n\n\tRecord Deleted ...";

getch();

//DETAILS OF ALL PRODUCTS//

void menu()

clrscr();

file.open("Shop.dat",ios::in);

if(!file)

cout<<"FILE MISSING!!! ABORTING...\n";

cout<<"Access admin menu to create a file";

cout<<"\n\n\n TERMINATING PROGRAM ...";

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();

//ORDER AND INVOICE GENERATION//

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

{ cout<<"\n\nEnter the product no. : ";

cin>>order_arr[i];

cout<<"\nQuantity : ";

cin>>quan[i];

i++;

cout<<"\nDo You Want To Order Another Product ? (y/n)";

cin>>ch;

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

cout<<"\n\nThank You For Placing Your Order";

getch();

clrscr();

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

cout<<"\nPr No.\tPR NAME\t QUANTITY \tPRICE \tAMOUNT \tDISCOUNTED


AMOUNT\n";

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);

cout<<"WELCOME TO EASYDAY SUPERMARKET";

gotoxy(22,14);

cout<<"ONE PLACE FOR ALL YOUR NEEDS";

gotoxy(35,17);

cout<<"PROJECT";

cout<<"\n\nMADE BY : FARHAN KHAN";

cout<<"\n\nSCHOOL : DELHI PUBLIC SCHOOL ELDECO";

getch();

// ADMINISTRATOR MENU//

void admin_menu()

17
{

clrscr();

char ch2;

cout<<"\n\n\n\tADMINISTRATOR MENU";

cout<<"\n\n\t1.CREATE PRODUCT";

cout<<"\n\n\t2.DISPLAY PRODUCT DETAILS";

cout<<"\n\n\t3.VIEW SPECIFIC PRODUCT DETAILS ";

cout<<"\n\n\t4.MODIFY PRODUCT DETAILS";

cout<<"\n\n\t5.DELETE PRODUCT DETAILS";

cout<<"\n\n\t6.VIEW PRODUCT MENU";

cout<<"\n\n\t7.BACK TO MAIN MENU";

cout<<"\n\n\tPlease 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<<"\n\n\tPlease Enter The Product No. ";

cin>>num;

display_sp(num);

break;

case '4': modify_product();

break;

18
case '5': delete_product();

break;

case '6': menu();

getch();

case '7': break;

default : cout<<"\a";

admin_menu();

// INTRODUCTION MENU FUNCTION//

void main()

char ch;

intro();

do

clrscr();

cout<<"\n\n\n\tMAIN MENU";

cout<<"\n\n\t1.CUSTOMER BILLING MENU";

cout<<"\n\n\t2.ADMINISTRATOR MENU";

cout<<"\n\n\t3.EXIT";

cout<<"\n\n\tPlease Select Your Option (1-3) ";

ch=getche();

switch(ch)

19
{

case '1': clrscr();

place_order();

getch();

break;

case '2': admin_menu();

break;

case '3': exit(0);

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

 Computer Science with C++ by Sumita Arora


 Wikipedia

26

You might also like