Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Reshma Kodwani , BCA Third Year
1. SUBMITED BY
Reshma Kodwani
Bachelor of Computer Application II YEAR
Dezyne E’cole College
www.dezyneecole.com
INFORMATION TECHNOLOGY
PROJECT REPORT
C++ PROGRAMMING
Billing System
TOPIC
C++
2. Project Report
On
C++ Programming
At
Dezyne E’cole College
Ajmer
Submitted to
Dezyne E’cole College
Towards the
Partial Fulfillment on
Bachelor of Computer Application
By
Reshma Kodwani
Dezyne E’cole College
106/10 Civil Line, Ajmer
Tel – 0145-2624679
Www.dezyneecole.com
2016
3. Acknowledgement
I Reshma Kodwani, Student On Dezyne E’cole College, An Extremely
Grateful To Each And Every Individual. Who Has Contributed. In
Successful Completion Of My Project. I Express My Gratitude Towards
Dezyne E’cole College For Their. Guidance and Contrast Supervision As
Well As For Providing The Necessary Information And Support
Regarding The Completion Of Project
Thank You
4. 1 | P a g e
Synopsis
This Project Is A Minor. Project Made, Based On The Practical Concept
Of C++ This Project Has Made Our Basic Practical Concepts On C++
Strong
8. 5 | P a g e
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
// class in project
class product
{
int pno;
char name[50];
float price,tax,dis,qty;
public:
void create_product()
{
cout<<"n Please enter the product no of the product::";
cin>>pno;
cout<<endl;
cout<<"n Please enter the name of the product::";
gets(name);
cout<<endl;
cout<<"n Please enter the price of the product::";
cin>>price;
cout<<endl;
cout<<"n Please enter the discount of the product::";
cin>>dis;
cout<<endl;
}
void show_product()
{
cout<<"The product no. of the product::"<<pno<<endl;
cout<<"The name of the product::";
puts(name);
cout<<"The price of the product::"<<price<<endl;
cout<<"Discount::"<<dis;
}
int retpno()
{return pno;}
float retprice()
{return price;}
char *retname()
{return name;}
int retdis()
{return dis;}
9. 6 | P a g e
}; //CLASS ENDS HERE
//GLOBAL DECLARATION FOR STREAM OBJECT,OBJECT
fstream fp;
product pr;
//FUNCTION TO WRITE IN FILE
void write_product()
{
fp.open("shop.dat",ios::out|ios::app);
pr.create_product();
fp.write((char*)&pr,sizeof(pr));
fp.close();
cout<<"nnThe product has been created...";
getch();
}
//FUNCTION TO READ ALL THE RECORD FROM FILE
void display_all()
{
clrscr();
cout<<"nnDISPLAY ALL RECORD!!!nn";
fp.open("shop.dat ", ios::in);
while(fp.read((char*)&pr,sizeof(pr)))
{
pr.show_product();
cout<<"n=====================================n";
getch();
}
fp.close();
getch();
}
//FUNCTION TO READ THE SPECFIC RECORD FROM FILE
void display_sp(int n)
{
int flag=0;
fp.open("shop.dat",ios::in);
while(fp.read((char*)&pr,sizeof(pr)))
{
if(pr.retpno()==n)
{
clrscr();
10. 7 | P a g e
pr.show_product();
flag=1;
}
}
fp.close();
if(flag==0)
cout<<"n record not exist...";
getch();
}
//FUNCTION TO MODIFY RECORD OF FILE
void modify_product()
{
int no,found=0;
clrscr();
cout<<"n To Modify";
cout<<"n Please enter the product no of the product::";
cin>>no;
fp.open("shop.dat",ios::in|ios::out);
while(fp.read((char*)&pr,sizeof(pr))&&found==0)
{
if(pr.retpno()==no)
{
pr.show_product();
cout<<"Please enter the new details of
product::"<<endl ;
pr.create_product();
int pos=-1*sizeof(pr);
fp.seekg(pos,ios::cur);
fp.write ((char*)&pr,sizeof(pr));
cout<<"nn record updated...";
found=1;
}
}
fp.close();
if(found==0)
cout<<"nn record not found...";
getch();
}
// FUNCATION TO DELETE THE RECORD OF FILE
void delete_product()
{
int no;
clrscr();
11. 8 | P a g e
cout<<"nn Detail record ";
cout<<"nn Please enter the product no.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(pr)))
{
if(pr.retpno()!=no)
{
fp2.write((char*)&pr,sizeof(pr));
}
}
fp2.close();
fp.close();
remove("shop.dat");
rename("temp.dat","shop.dat");
cout<<"nn Record deleted....";
getch();
}
//FUNCTION TO DISPLAY ALL PRODUCT PRICE LIST
void menu()
{
clrscr();
fp.open("shop.dat",ios::in);
if(!fp)
{
cout<<"ERROR!!nNFile couldn't be openn go to admin
menu to create file ";
cout<<"n Program is closing....";
getch();
exit(0);
}
cout<<"nnt PRODUCT MENU nn";
cout<<"============================================
====n";
cout<<"PnottNamettPRICEn";
cout<<"============================================
====n";
while(fp.read((char*)&pr,sizeof(pr)))
12. 9 | P a g e
{
cout<<pr.retpno()<<"tt"<<pr.retname()<<"tt"<<pr.retprice()<<end
l;
}
fp.close();
cout<<"n=================";
cout<<"nPlace your order";
cout<<"n=================n";
}
//FUNCTION TO PLACE ORDER AND GENERATING BILL FOR
PRODUCTS
void place_order()
{
int order_arr[50],quan[50],c=0;
int amt,damt,tamt,tdis;
int total=0;
char ch='y';
order_arr[50]=0;
menu();
/* cout<<"n=================";
cout<<"nPlace your order";
cout<<"n=================n"; */
do{
cout<<"n Enter the product no of the product::";
cin>>order_arr[c];
if(order_arr[c]<7)
{
cout<<"n Quantity in number::";
cin>>quan[c];
}
else{ cout<<"product not available"<<endl;}
c++;
cout<<" Do you want order another product?(y/n)";
ch=getch();
if(ch=='y'||ch=='Y')
{
menu();
}
else
{
break;
13. 10 | P a g e
}
}while(1);
cout<<"n Thank you for placing the order...";
getch();
clrscr();
cout<<"nn
*********************************INVOICE*****************************n";
cout<<"n Pr no."<<" "<<"Pr name"<<" " <<"Quantity"<<" "
<<"Price"<<" "<<"Amount"<<" "<<"Amount after discountn";
for(int x=0;x<=c;x++)
{
fp.open("shop.dat",ios::in);
// fp.read((char*)&pr,sizeof(pr));
while(!fp.eof())
{
fp.read((char*)&pr,sizeof(pr));
if(pr.retpno()==order_arr[x])
{
amt=pr.retprice()*quan[x] ;
// cout<<"amt:"<<amt<<endl;
tamt=(amt*quan[x]);
tdis=pr.retdis()*quan[x];
// cout<<"tdis:"<<tdis<<endl;
damt=amt-tdis;
// cout<<"damt:"<<damt;
cout<<"n"<<" "<<order_arr[x]<<"t
"<<pr.retname()<<"tt "<<quan[x]<<"t "<<pr.retprice()<<"t "<<amt<<"
t "<<damt;
total=total+damt;
}
}
fp.close();
}
cout<<"nnttttttt TOTAL="<<total;
getch();
}
//INTRODUCTION FUNCTION
void intro()
{
clrscr();
14. 11 | P a g e
gotoxy(31,11);
cout<<" SUPER MARKET";
gotoxy(35,14);
cout<<"BILLING";
gotoxy(35,17);
cout<<"PROJECT";
cout<<"nntt MADE BY: RESHMA KODWANI AND KIRTI
KUMAWAT";
cout<<"ntt COLLEGE: DEZYNE E'COLE COLLEGE";
getch();
}
//ADMINSTRATOR MENU FUNCTION
void admin_menu()
{
l1:
// l2:
l3:
l4:
l5:
l6:
clrscr();
char ch2;
cout<<"nn ADMIN MENU";
cout<<"nn 1. CREATE PRODUCT";
cout<<"nn 2. DISPLAY ALL PRODUCT";
cout<<"nn 3. SEARCH THE SPRCIFC PRODUCT";
cout<<"nn 4. MODIFY PRODUCT";
cout<<"nn 5. DELETE PRODUCT";
cout<<"nn 6. VIEW PRODUCT MENU";
cout<<"nn 7. BACK TO MAIN MENU";
cout<<"nn Please enter your choice (1-7)";
ch2=getche();
switch(ch2)
{
case '1':clrscr();
write_product();
goto l1;
break;
case '2':display_all();
goto l1;
break;
15. 12 | P a g e
case'3':
int num;
clrscr();
cout<<"nn Please enter the product no ";
cin>>num;
display_sp(num);
goto l3;
break;
case '4': modify_product();
goto l4;
break;
case '5': delete_product();
goto l5;
break;
case '6':menu();
getch();
goto l6;
case'7':break;
default:cout<<"a";
admin_menu();
}
}
// THE MAIN FUNCTION OF PROGRAM
void main()
{
char ch;
intro();
do{
clrscr();
textcolor(6);
cout<<"nnt MAIN MENU";
cout<<"nnt 01. CUSTOMER";
cout<<"nnt 02. ADMINSTRTOR";
cout<<"nnt 03. EXIT";
cout<<"nnt Please select your options(1-3)";
ch=getche();
switch(ch)
{
case '1':clrscr();
place_order();
16. 13 | P a g e
getch();
break;
case '2': admin_menu();
break;
case '3':exit(0);
default:cout<<"a";
}
}while(ch!='3');
}
//END OF PROGRAM