//***************************************************************

// 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;}
int retdis()
{return dis;}
}; //class ends here
//***************************************************************
// global declaration for stream object, object
//****************************************************************
fstream fp;
product pr;

flag=1.sizeof(product)). } //*************************************************************** // function to modify record of file //**************************************************************** . cout<< \n\nThe Product Has Been Created getch().create_product(). if(flag==0) cout<< \n\nrecord not exist .read((char*)&pr.sizeof(product))) { pr. while(fp. while(fp. } } fp.close(). getch().close().ios::in).show_product(). } //*************************************************************** // function to read specific record from file //**************************************************************** void display_sp(int n) { int flag=0.retpno()==n) { clrscr().open( Shop.dat .dat . pr. cout<< \n\n====================================\n . } . cout<< \n\n\n\t\tDISPLAY ALL RECORD !!!\n\n . getch(). fp. pr.open( Shop. getch().read((char*)&pr. fp.sizeof(product))) { if(pr. } fp. fp.//*************************************************************** // function to write in file //**************************************************************** void write_product() { fp.close(). //*************************************************************** // function to read all records from file //**************************************************************** void display_all() { clrscr(). fp.show_product().ios::in).ios::out|ios::app).open( Shop.write((char*)&pr.dat .

write((char*)&pr.found=0.close().sizeof(product)). pr.open( Shop. cout<< \nPlease Enter The New Details of Product <<endl.dat . rename( Temp. cout<< \n\n\t Record Updated .ios::in|ios::out).retpno()!=no) { fp2. cin>>no. cout<< \n\nPlease Enter The product no. fp.retpno()==no) { pr.close().dat . cout<< \n\n\tRecord Deleted . cin>>no.seekg(0. fp.ios::out). int pos=-1*sizeof(pr). fp.dat ).show_product(). ..sizeof(product))) { if(pr. if(found==0) cout<< \n\n Record Not Found .sizeof(product)) && found==0) { if(pr. fstream fp2. fp2. cout<< \n\n\tPlease Enter The Product No.dat .open( Temp.ios::beg).read((char*)&pr. Shop. remove( Shop. while(fp. of The Product You Want To Delete . cout<< \n\n\tTo Modify . found=1.dat .read((char*)&pr.open( Shop. of The Product . } //*************************************************************** // function to delete record of file //**************************************************************** void delete_product() { int no. while(fp. } } fp.ios::in|ios::out). fp. cout<< \n\n\n\tDelete Record .write((char*)&pr. getch(). } } fp2.seekp(pos.close(). clrscr(). getch(). fp.sizeof(product)).void modify_product() { int no. clrscr().ios::cur).dat ). } //*************************************************************** .create_product(). fp.

do{ cout<< \n\nEnter The Product No.sizeof(product))) { cout<<pr. cout<< \n\nThank You For Placing The Order . cin>>order_arr[c]. .c=0. P. menu().open( Shop. cout<< \n============================ . char ch= Y'.quan[50]. cout<< \nPr No. ====================================================\n .// function to display all products price list //**************************************************************** void menu() { clrscr(). cout<< \n PLACE YOUR ORDER . for(int x=0.ios::in).x<=c. }while(ch== y ||ch== Y').retpno()<< \t\t <<pr. fp. exit(0). Of The Product : . ====================================================\n . cout<< \n============================\n .damt. cout<< \nQuantity in number : .read((char*)&pr.\tPr Name\tQuantity \tPrice \tAmount \tAmount after discount\n .total=0.clrscr(). } //*************************************************************** // function to place order and generating bill for Products //**************************************************************** void place_order() { int order_arr[50]. cout<< \nDo You Want To Order Another Product ? (y/n) .retname()<< \t\t <<pr. cin>>ch.x++) { . cout<< \n \n********************************INVOICE************************\n . cout<< \n\n\n Program is closing . c++. float amt.dat .NO.\t\tNAME\t\tPRICE\n . getch(). } cout<< cout<< cout<< cout<< \n\n\t\tProduct MENU\n\n . if(!fp) { cout<< ERROR!!! FILE COULD NOT BE OPEN\n\n\n Go To Admin Menu to create File .getch(). cin>>quan[c].retprice()<<endl. } fp. while(fp.close().

DELETE PRODUCT .read((char*)&pr.11). cout<< \n\n\t5. cout<< \n\n\t1. } //*************************************************************** // INTRODUCTION FUNCTION //**************************************************************** void intro() { clrscr(). fp.sizeof(product)). getch().BACK TO MAIN MENU . cout<< \n\n\t7.eof()) { if(pr.retdis()/100).fp. cout<< \n\n\t4. } fp. cout<< \n <<order_arr[x]<< \t <<pr.ios::in). damt=amt-(amt*pr.QUERY . gotoxy(35.14).close().retprice()*quan[x]. ch2=getche().open( Shop.retpno()==order_arr[x]) { amt=pr.sizeof(product)). cout<< \n\n\t6. cout<< \n\n\tPlease Enter Your Choice (1-7) . while(!fp.MODIFY PRODUCT .read((char*)&pr. total+=damt. cout<< BILLING .17).VIEW PRODUCT MENU . } //*************************************************************** // ADMINSTRATOR MENU FUNCTION //**************************************************************** void admin_menu() { clrscr().retname() << \t <<quan[x]<< \t\t <<pr. } cout<< \n\n\t\t\t\t\tTOTAL = <<total. gotoxy(31. char ch2. switch(ch2) { .retprice()<< \t <<amt<< \t\t <<damt.CREATE PRODUCT . cout<< \n\nSCHOOL : RYAN INTERNATIONAL SCHOOL . cout<< SUPER MARKET .DISPLAY ALL PRODUCTS . cout<< \n\n\t2.dat . getch(). gotoxy(35. } fp. cout<< \n\n\t3. cout<< PROJECT . cout<< \n\n\n\tADMIN MENU . cout<< \n\nMADE BY : ANUJ KUMAR .

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