BILL CALCULATION PROGRAM WITH PASSWORD ACCESS
----------------------------------------------------------------------------------------
//PLEASE COMMENT ON THIS PROGRAM
It has to be done in two steps :-
STEP(1) :- Paste below code in NOTEPAD of INCLUDE folder of C or C++ compiler .As u run the program it asks password it is secret ..........but only for u it is 888 .Save this notepad with "password.h" extension.
//////////////////////////////////////////////////////////////////////////////////////
int password() |
{ | part of program
int c; | to be
char o; | placed in the TURBOC=> BIN=> INCLUDE
c='o'*8; | INCLUDE
return c; | folder of turbo
} | C or C++.
/////////////////////////////////////////////////////////////////////////////////////
STEP(2) :- Place this code in new file and save it as we do generally by giving file name of your choice.
=>Shop bill is available to products listed below :- "britaniya";"threeroses";"colgate";"cellofinegrip";"ricebag";"doormat";"rexona";"dove";"sunfloweroil";
"rin";"dairymilk";"fa";
=>Some prodducts may not have product name so u can enter amount from '1' to '30' instead of product name.
************************************************************************************
#include<graphics.h>
#include<iostream.h>
#include <conio.h>
#include<password.h>
#include<dos.h>
#include<string.h>
#include<process.h>
class visu
{public:
int i,p,l,z;char c[20];
void i1(char a[20])
{
strcpy(c,a);
l=strlen(c);
cout<<"Quantity of product : ";cin>>p;
}
void p1()
{
char c1[10]="britaniya";char c2[13]="threeroses";
char c3[8]="colgate";char c4[15]="cellofinegrip";
char c5[8]="ricebag";char c6[8]="doormat";
char c7[8]="rexona";char c8[6]="dove";
char c9[15]="sunfloweroil";char c10[5]="rin";
char c11[10]="dairymilk";char c12[3]="fa";
char c13[2]="3";char c14[2]="1";char c15[2]="2";
char c16[2]="4";char c17[2]="5";char c18[2]="6";char c19[2]="7";
char c20[2]="8";char c21[2]="9";char c22[3]="10";
char c23[3]="11";char c24[3]="12";char c25[3]="13";
char c26[3]="14";char c27[3]="15";char c28[3]="16";char c29[3]="17";
char c30[3]="18";char c31[3]="19";char c32[3]="20";
char c33[3]="21";char c34[3]="22";char c35[3]="23";char c36[3]="24";char c37[3]="25";char c38[3]="26";char c39[3]="27";char c40[3]="28";char c41[3]="29";char c42[3]="30";
if(strcmp(c,c1)==0){i=10;}
else if(strcmp(c,c2)==0){i=45;}else if(strcmp(c,c3)==0){i=54;}
else if(strcmp(c,c4)==0){i=6;}else if(strcmp(c,c5)==0){i=1200;}
else if(strcmp(c,c6)==0){i=30;}else if(strcmp(c,c7)==0){i=18;}
else if(strcmp(c,c8)==0){i=30;}else if(strcmp(c,c9)==0){i=70;}
else if(strcmp(c,c10)==0){i=10;}else if(strcmp(c,c11)==0){i=10;}
else if(strcmp(c,c12)==0){i=120;}else if(strcmp(c,c13)==0){i=3;}
else if(strcmp(c,c14)==0){i=1;}else if(strcmp(c,c15)==0){i=2;}
else if(strcmp(c,c16)==0){i=4;}else if(strcmp(c,c17)==0){i=5;}
else if(strcmp(c,c18)==0){i=6;}else if(strcmp(c,c19)==0){i=7;}
else if(strcmp(c,c20)==0){i=8;}else if(strcmp(c,c21)==0){i=9;}
else if(strcmp(c,c22)==0){i=10;}if(strcmp(c,c23)==0){i=11;}
else if(strcmp(c,c24)==0){i=12;}else if(strcmp(c,c25)==0){i=13;}
else if(strcmp(c,c26)==0){i=14;}else if(strcmp(c,c27)==0){i=15;}
else if(strcmp(c,c28)==0){i=16;}else if(strcmp(c,c29)==0){i=17;}
else if(strcmp(c,c30)==0){i=18;}else if(strcmp(c,c31)==0){i=19;}
else if(strcmp(c,c32)==0){i=20;}
else if(strcmp(c,c33)==0){i=21;}else if(strcmp(c,c34)==0){i=22;}else if(strcmp(c,c35)==0){i=23;}else if(strcmp(c,c36)==0){i=24;}else if(strcmp(c,c37)==0){i=25;}else if(strcmp(c,c38)==0){i=26;}else if(strcmp(c,c39)==0){i=27;}else if(strcmp(c,c40)==0){i=28;}else if(strcmp(c,c41)==0){i=29;}else if(strcmp(c,c42)==0){i=30;}
//else{cout<<"PRODUCT IS NOT AVAILABLE";}
//else{i=0;}
}
void s(int z)
{for(int y=0;y<z-l;y++)
{cout<<" ";
}
}
void s1(int z)
{for(int y=0;y<z-1;y++)
{cout<<" ";
}
}
int o1()
{
int m;
setcolor(2);
settextstyle(2,0,7);
outtextxy(21,5,"product Quantity Amount");
m=i*p;
cout<<"\n\n\n "<<c;s(30);cout<<p;s1(27);cout<<m;return m;
}
};
void main()
{visu v[20]; char f[20]="e"; int r,b;
char g[20]="a";
clrscr();
int a=DETECT,d,i=1,u,m=0,z;
initgraph(&a,&d,"C:\\TurboC3\\BGI");
cout<<"\n\n\n\n\n\n\n\n\n\n\n ";
cout<<"password please : ";
cin>>b;
r=password();
//cout<<r;
if(r==b)
{clrscr();cleardevice();
while(strcmp(g,f)!=0)
{
cout<<"\nName of product/Rs : ";
cin>>g;
if(strcmp(g,f)!=0)
{
v[i].i1(g);
v[i].p1(); i++;
cout<<"\n*********************** Press e to get bill *****************************";cout<<"\n";
}
else
{
cout<<"\ncheck wether particulars are True(1) or Not(0) :";
cin>>u;
if(u==1)
{
clrscr();cleardevice();
}
else{
exit(0);
}
}
}
line(18,5,560,5);
line(18,33,560,33);
line(18,5,18,33);
line(560,5,560,33);
for(int j=1;j<=i-1;j++)
{
z=v[j].o1();
m=m+z;
}
setcolor(15);
line(18,33,18,i*46);
line(560,33,560,i*46);
line(18,i*46,560,i*46);
cout<<"\n\n\n TOTAL : ";
cout<<m;
line(18,i*46,18,i*46+56);
line(560,i*46,560,i*46+56);
line(18,i*46+56,560,i*46+56);
}
else{
cout<<"\n\n\n\n\n\n\n\n\n\n\n ";
cout<<"wrong password try again";
}
getch();
}
************************************************************************************
----------------------------------------------------------------------------------------
//PLEASE COMMENT ON THIS PROGRAM
It has to be done in two steps :-
STEP(1) :- Paste below code in NOTEPAD of INCLUDE folder of C or C++ compiler .As u run the program it asks password it is secret ..........but only for u it is 888 .Save this notepad with "password.h" extension.
//////////////////////////////////////////////////////////////////////////////////////
int password() |
{ | part of program
int c; | to be
char o; | placed in the TURBOC=> BIN=> INCLUDE
c='o'*8; | INCLUDE
return c; | folder of turbo
} | C or C++.
/////////////////////////////////////////////////////////////////////////////////////
STEP(2) :- Place this code in new file and save it as we do generally by giving file name of your choice.
=>Shop bill is available to products listed below :- "britaniya";"threeroses";"colgate";"cellofinegrip";"ricebag";"doormat";"rexona";"dove";"sunfloweroil";
"rin";"dairymilk";"fa";
=>Some prodducts may not have product name so u can enter amount from '1' to '30' instead of product name.
************************************************************************************
#include<graphics.h>
#include<iostream.h>
#include <conio.h>
#include<password.h>
#include<dos.h>
#include<string.h>
#include<process.h>
class visu
{public:
int i,p,l,z;char c[20];
void i1(char a[20])
{
strcpy(c,a);
l=strlen(c);
cout<<"Quantity of product : ";cin>>p;
}
void p1()
{
char c1[10]="britaniya";char c2[13]="threeroses";
char c3[8]="colgate";char c4[15]="cellofinegrip";
char c5[8]="ricebag";char c6[8]="doormat";
char c7[8]="rexona";char c8[6]="dove";
char c9[15]="sunfloweroil";char c10[5]="rin";
char c11[10]="dairymilk";char c12[3]="fa";
char c13[2]="3";char c14[2]="1";char c15[2]="2";
char c16[2]="4";char c17[2]="5";char c18[2]="6";char c19[2]="7";
char c20[2]="8";char c21[2]="9";char c22[3]="10";
char c23[3]="11";char c24[3]="12";char c25[3]="13";
char c26[3]="14";char c27[3]="15";char c28[3]="16";char c29[3]="17";
char c30[3]="18";char c31[3]="19";char c32[3]="20";
char c33[3]="21";char c34[3]="22";char c35[3]="23";char c36[3]="24";char c37[3]="25";char c38[3]="26";char c39[3]="27";char c40[3]="28";char c41[3]="29";char c42[3]="30";
if(strcmp(c,c1)==0){i=10;}
else if(strcmp(c,c2)==0){i=45;}else if(strcmp(c,c3)==0){i=54;}
else if(strcmp(c,c4)==0){i=6;}else if(strcmp(c,c5)==0){i=1200;}
else if(strcmp(c,c6)==0){i=30;}else if(strcmp(c,c7)==0){i=18;}
else if(strcmp(c,c8)==0){i=30;}else if(strcmp(c,c9)==0){i=70;}
else if(strcmp(c,c10)==0){i=10;}else if(strcmp(c,c11)==0){i=10;}
else if(strcmp(c,c12)==0){i=120;}else if(strcmp(c,c13)==0){i=3;}
else if(strcmp(c,c14)==0){i=1;}else if(strcmp(c,c15)==0){i=2;}
else if(strcmp(c,c16)==0){i=4;}else if(strcmp(c,c17)==0){i=5;}
else if(strcmp(c,c18)==0){i=6;}else if(strcmp(c,c19)==0){i=7;}
else if(strcmp(c,c20)==0){i=8;}else if(strcmp(c,c21)==0){i=9;}
else if(strcmp(c,c22)==0){i=10;}if(strcmp(c,c23)==0){i=11;}
else if(strcmp(c,c24)==0){i=12;}else if(strcmp(c,c25)==0){i=13;}
else if(strcmp(c,c26)==0){i=14;}else if(strcmp(c,c27)==0){i=15;}
else if(strcmp(c,c28)==0){i=16;}else if(strcmp(c,c29)==0){i=17;}
else if(strcmp(c,c30)==0){i=18;}else if(strcmp(c,c31)==0){i=19;}
else if(strcmp(c,c32)==0){i=20;}
else if(strcmp(c,c33)==0){i=21;}else if(strcmp(c,c34)==0){i=22;}else if(strcmp(c,c35)==0){i=23;}else if(strcmp(c,c36)==0){i=24;}else if(strcmp(c,c37)==0){i=25;}else if(strcmp(c,c38)==0){i=26;}else if(strcmp(c,c39)==0){i=27;}else if(strcmp(c,c40)==0){i=28;}else if(strcmp(c,c41)==0){i=29;}else if(strcmp(c,c42)==0){i=30;}
//else{cout<<"PRODUCT IS NOT AVAILABLE";}
//else{i=0;}
}
void s(int z)
{for(int y=0;y<z-l;y++)
{cout<<" ";
}
}
void s1(int z)
{for(int y=0;y<z-1;y++)
{cout<<" ";
}
}
int o1()
{
int m;
setcolor(2);
settextstyle(2,0,7);
outtextxy(21,5,"product Quantity Amount");
m=i*p;
cout<<"\n\n\n "<<c;s(30);cout<<p;s1(27);cout<<m;return m;
}
};
void main()
{visu v[20]; char f[20]="e"; int r,b;
char g[20]="a";
clrscr();
int a=DETECT,d,i=1,u,m=0,z;
initgraph(&a,&d,"C:\\TurboC3\\BGI");
cout<<"\n\n\n\n\n\n\n\n\n\n\n ";
cout<<"password please : ";
cin>>b;
r=password();
//cout<<r;
if(r==b)
{clrscr();cleardevice();
while(strcmp(g,f)!=0)
{
cout<<"\nName of product/Rs : ";
cin>>g;
if(strcmp(g,f)!=0)
{
v[i].i1(g);
v[i].p1(); i++;
cout<<"\n*********************** Press e to get bill *****************************";cout<<"\n";
}
else
{
cout<<"\ncheck wether particulars are True(1) or Not(0) :";
cin>>u;
if(u==1)
{
clrscr();cleardevice();
}
else{
exit(0);
}
}
}
line(18,5,560,5);
line(18,33,560,33);
line(18,5,18,33);
line(560,5,560,33);
for(int j=1;j<=i-1;j++)
{
z=v[j].o1();
m=m+z;
}
setcolor(15);
line(18,33,18,i*46);
line(560,33,560,i*46);
line(18,i*46,560,i*46);
cout<<"\n\n\n TOTAL : ";
cout<<m;
line(18,i*46,18,i*46+56);
line(560,i*46,560,i*46+56);
line(18,i*46+56,560,i*46+56);
}
else{
cout<<"\n\n\n\n\n\n\n\n\n\n\n ";
cout<<"wrong password try again";
}
getch();
}
************************************************************************************