Acknowledgement

WE would Like To Convey Our Heart Felt
Thanks To Miss Pallavi Mandelia Our Computer
Science Teacher Who Always Give Us Valuable
Suggestion And Guidance For Completion Of Our
Project.
He Helped Us TO Understand And
Remember Importance Details Of The Project That
We Would Have
Otherwise Lost. Our Project Has Been Success Only
Because
His Guidence.

Name Of The Students:- Pritam Kumar
esh Sharma

And
Rit

Certificate
This Is Certified That Mr. Ritesh Sharma And
Pritam Kumar ….. Of Class XII – B Of H. J. S. S.
School Pilani. Has Completed Her Project File Under
My Supervision.
He Has Take Proper Care And Shown Utmost
Sincerity In Completion Of This Project.
I Certify That This Project Is Up To My
Expectation And As Per The GuideLines Issued By
C. B.S. E.
Miss Pallavi Mandelia.
(C.S. Teacher)

………………………
(Signature)

1. 1-9 2.Index SNo. 10-14 Topic Signature A Program to Generate a Super Market Bill . Output Of Program . Page No.

h> #include<stdio. char name[50].tax. public: .//*********************************************************** **** // HEADER FILE USED IN PROJECT //*********************************************************** ***** #include<conio.h> #include<fstream.h> #include<process. float price.dis.h> //*********************************************************** **** // CLASS USED IN PROJECT //*********************************************************** ***** class product { int pno.qty.

cout<<"\nThe Price of The Product : "<<price.void create_product() { cout<<"\nPlease Enter The Product No. cin>>dis. cout<<"\nPlease Enter The Discount (%) ".} }. char* retname() {return name. cin>>pno. gets(name). of The Product ". } int retpno() {return pno. cout<<"\nPlease Enter The Price of The Product ". cout<<"\nDiscount : "<<dis. } void show_product() { cout<<"\nThe Product No. of The Product : "<<pno. cout<<"\nThe Name of The Product : ". cout<<"\n\nPlease Enter The Name of The Product ". puts(name). //Class Ends Here .} 1. cin>>price.} float retprice() {return price.} int retdis() {return dis.

pr. //*********************************************************** **** // FUNCTIONTO WRITE IN FILE //*********************************************************** ***** void write_product() { fp. cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n".dat". OBJECT //*********************************************************** ***** fstream fp.ios::out|ios::app). getch().open("Shop. cout<<"\n\nThe Product Has Been Created ".create_product().write((char*)&pr.close().//*********************************************************** **** // GLOBAL DECLARAATION FOR STREAM OBJECT. .sizeof(product)). fp. } //*********************************************************** **** // FUNCTION TO READ ALL RECORDS FROM FILE //*********************************************************** ***** void display_all() { clrscr(). product pr. fp.

close().dat".show_product().read((char*)&pr. } //*********************************************************** **** // FUNCION TO READ SPECIFICE REACORD FROM FILE //*********************************************************** ***** void display_sp(int n) { int flag=0.open("Shop.sizeof(product))) 2.ios::in).show_product(). } fp. getch(). pr. while(fp. } } fp.read((char*)&pr. cout<<"\n\n============================ ========\n".dat". if(flag==0) cout<<"\n\nrecord not exist".open("Shop.retpno()==n) { clrscr(). while(fp.ios::in). { pr.sizeof(product))) { if(pr. . flag=1. fp. getch().close().fp.

if(found==0) cout<<"\n\n Record Not Found ".show_product().retpno()==no) { pr.ios::in|ios::out). cout<<"\nPlease Enter The New Details of Product"<<endl.seekp(pos. } } fp.getch(). fp.dat". .create_product().open("Shop.close().read((char*)&pr. fp. 3. fp. found=1. clrscr().found=0. } //*********************************************************** **** // FUNCTION TO MODIFY THE RECORD OF FILE //*********************************************************** ***** void modify_product() { int no.sizeof(product)). while(fp.write((char*)&pr. of The Product". pr. int pos=-1*sizeof(pr). cin>>no. cout<<"\n\n\t Record Updated".sizeof(product)) && found==0) { if(pr.ios::cur). cout<<"\n\n\tPlease Enter The Product No. cout<<"\n\n\tTo Modify ".

getch(). cout<<"\n\nPlease Enter The product no.ios::out). fstream fp2.dat").". fp."Shop. 4. } .dat"). clrscr(). fp2. cout<<"\n\n\n\tDelete Record". of The Product You Want To Delete". } } fp2.close().dat". fp.dat".read((char*)&pr.dat".close(). fp.retpno()!=no) { fp2. cout<<"\n\n\tRecord Deleted . cin>>no.ios::beg). getch(). } //****************************************************** ********* // FUNCTION TO DELETE THE RECORD OF FILE //*********************************************************** ***** void delete_product() { int no. rename("Temp.sizeof(product))) { if(pr.seekg(0.sizeof(product)).ios::in|ios::out).open("Shop.open("Temp. remove("Shop.write((char*)&pr.. while(fp.

cout<<"\n\n\n Program is closing .. if(!fp) { cout<<"ERROR!!! FILE COULD NOT BE OPEN\n\n\n Go To Admin Menu to create File".NO.retname()<<"\t\t"<<pr.. cout<<"============================== ======================\n".retpno()<<"\t\t"<<pr. cout<<"P. exit(0). getch(). } ..sizeof(product))) { cout<<pr.".dat". } cout<<"\n\n\t\tProduct MENU\n\n". } fp.ret price()<<endl.//*********************************************************** **** // FUNCTION TO DISPLAY ALL THE PRODECTS PRICE LIST //*********************************************************** ***** void menu() { clrscr().\t\tNAME\t\tPRICE\n".close(). cout<<"============================== ======================\n".open("Shop.read((char*)&pr. while(fp.ios::in). fp.

cout<<"\nQuantity in number : ". cout<<"\n============================ ". cout<<"\n\n********************************INVOICE*** *********************\n".total=0. cout<<"\n PLACE YOUR ORDER".x++) . float amt. cin>>ch. cout<<"\nPr No. cout<<"\nDo You Want To Order Another Product ? (y/n)".damt.x<=c.\tPr Name\tQuantity \tPrice \tAmount \tAmount after discount\n".5.clrscr(). //*********************************************************** **** // FUNCTION TO PLACE ORDER AND GENERATING BILL FOR // PRODECTS //*********************************************************** ***** void place_order() { int order_arr[50].getch(). cout<<"\n\nThank You For Placing The Order". cin>>order_arr[c].quan[50]. c++. do{ cout<<"\n\nEnter The Product No. cout<<"\n============================ \n". char ch='Y'. for(int x=0.c=0. menu(). Of The Product : ". }while(ch=='y' ||ch=='Y'). cin>>quan[c].

open("Shop. gotoxy(31.14). gotoxy(35.retprice()*quan[x]. while(!fp.read((char*)&pr.retpno()==order_arr[x]) { amt=pr.read((char*)&pr.sizeof(product)). cout<<"BILLING". total+=damt.dat". } fp.sizeof(product)). cout<<"\n"<<order_arr[x]<<"\t"<<pr. } cout<<"\n\n\t\t\t\t\tTOTAL = "<<total. damt=amt-(amt*pr.11).retprice()<<"\t"<<amt<<"\t\t"<<da mt. 6. getch().retdis()/100). gotoxy(35.close().ios::in).eof()) { if(pr. . } fp. fp.{ fp. } //*********************************************************** **** // INTRODUCTION FUNCTION //*********************************************************** ***** void intro() { clrscr().17).retname()<<"\t"<< quan[x]<<"\t\t"<<pr. cout<<"SUPER MARKET".

cout<<"\n\nMADE BY : Pritam Kumar And Ritesh Sharma".DELETE PRODUCT". switch(ch2) { case '1': clrscr(). cout<<"\n\n\t4.Pilani". cout<<"\n\n\n\tADMIN MENU".BACK TO MAIN MENU".MODIFY PRODUCT". getch(). case '2': display_all().QUERY ". ch2=getche().CREATE PRODUCT". cout<<"\n\n\t2. cout<<"\n\n\t6. case '3': int num.cout<<"PROJECT".DISPLAY ALL PRODUCTS".VIEW PRODUCT MENU". write_product(). . break.break. } //*********************************************************** **** // ADMINSTRATOR MENU FUNCTION //*********************************************************** ***** void admin_menu() { clrscr(). cout<<"\n\nSCHOOL : Hari Devi Jhutharam SCHOOL. cout<<"\n\n\t7. cout<<"\n\n\t3. cout<<"\n\n\t1. char ch2. cout<<"\n\n\t5. cout<<"\n\n\tPlease Enter Your Choice (1-7) ". 7.

clrscr(). case '7': break. CUSTOMER". } } //*********************************************************** **** // THE MAIN FUNCTION OF PROGRAM //*********************************************************** ***** void main() { char ch. cout<<"\n\n\t03.break. do { clrscr(). getch().break. cout<<"\n\n\t02. display_sp(num). ". ADMINISTRATOR". default:cout<<"\a". case '5': delete_product(). intro(). cout<<"\n\n\n\tMAIN MENU". cout<<"\n\n\tPlease Enter The Product No.admin_menu(). EXIT". cout<<"\n\n\t01. ch=getche(). cin>>num. switch(ch) { case '1': clrscr(). cout<<"\n\n\tPlease Select Your Option (1-3) ". . case '4': modify_product(). break. case '6': menu(). 8.

case '2': admin_menu(). default :cout<<"\a". case '3':exit(0). break.  .place_order(). } }while(ch!='3'). } //*********************************************************** **** // END OF PROJECT //*********************************************************** **** 9. getch(). break.

.

. 10 .

11 ..

.12 .

. 13 .

End Of The File........ .  14.