Anda di halaman 1dari 40

1. 2 3. 4. 5. 6. 7. 8. 9. 10. 11.

CERTIFICATE OF ORIGINALITY ACKNOWLEDGEMENT ABOUT THE PROJECT SYSTEM REQUIREMENTS


HEADER FILES VARIABLE DESCRIPTION FUNCTION DESCRIPTION LOGIC DIAGRAM SOURCE COD
E OUTPUT SCREENS BIBLIOGRAPHY
3 4 5 6 7 8 10 11 12-28
29-38
39

PG 3
This is to certify that this project work is submitted by Arka roy to the COMPUT
ER department, Kendriya Vidyalaya Garden Reach, Kolkata.
It was carried out by him under the guidance & supervision OF RANJITA SARKAR MON
DAL, head of computer science department during academics Year 2013-2014. Signat
ure of TEACHER

PG 4
I wish to express my deep gratitude and sincere thanks To Principal, Mr. VENOGOP
AL, Kendriya Vidyalaya Garden Reach school, Kolkata for his encouragement and fo
r all Facilities that he provided for this project work. I sincerely appreciate
this magnanimity by taking me into His fold for which I shall remain indebted to
him. I extend my hearty thanks to Mrs. RANJITA SARKAR, Computer Science HOD, wh
o guided me to the successful Completion of this project. I take this opportunit
y to Express my deep sense of gratitude for her invaluable Guidance, constant en
couragement, constructive comments, Sympathetic attitude and immense motivation,
Which has sustained my efforts at all stages Of this project work. I am also th
ankful to my group members Who have helped in each step of my Project work? I ca
n't forget to offer my sincere thanks to my Classmates who helped me to carry ou
t this project work Successfully & for their valuable advice & support, Which I
received from them time to time.
ARKA ROY

PG 5
The project comprises of a shopping mall and is developed on the C++ platform so
that the program can be used for account management and online shopping. Here y
ou can shop to your hearts content. Our program allows you to shop from different
stores as it brings you a Daily Market, a Bookstore and a Gadget shop all under
one roof. It even provides you with the feature of paying your bill online or s
aving it as a wish list. It also provides flexible paying option via VISA or COD
. It has a special feature of displaying the previous bills along with the curre
nt bill.
Technical Information
The logic of this program is based on selective delimitation by get line functio
n in various files. Firstly we extract the categories by locating the + sign in ou
r storage file. Then the pointer is taken right to that category number by delim
iting the pointers position through an iterative structure for the number of line
s which equals to the choice number. For arts and diagrams, ASCII arts has been
implemented from the file.

PG 6
Minimum System Requirements:
Processor Intel Pentium III or above Hard-disk Space- 20 MB RAM Platform 512 mb
or more Windows XP,7 or 8
Software : Borland Turbo C++ 5.02

PG 7
PG 7
1.) CONIO.H TO USE CLEARSCREEEN AND GETCH FUNCTION FORFORMATTING IN PROGRAM 2.)
IOSTREAM.HFOR USING INPUT OUTPUT PRE-DEFINED STREAM FUNCTIONS IN THE PROGRAM 3.)
STRING.HTO USE STRING RELATED FUNCTIONS IN THE PROGRAM 4.) STDIO.HTO USE GETS()
AND PUTS() FUNCTION FOR STRING INPUT 5.) FSTREAM.H FOR USING INPUT AND OUTPUT F
ILES RELATED OPERATION IN THE PROGRAM 6.) STDLIB.H TO USE STANDARD LIBRARY FUNCT
IONS LIKE SRAND IN THE PROGRAM 7.) PROCESS.H - FOR USING INSTANTANEOUS EXIT FUNC
TION IN THE PROGRAM 8.) TIME.H- FOR INITIALIZING SRAND WITH RANDOM NUMBER GENERA
TED BY THE SYSTEM INTERNAL CLOCK

PG 8
Function name
Name
Type
Use
blink() blink() blink() blink()
ch i d q
char int long long double
read from loading.txt counter variable to manipulate waiting period used in dela
y loop
billing_centre() billing_centre() billing_centre() billing_centre() billing_cent
re() billing_centre() billing_centre() billing_centre() billing_centre() billing
_centre() billing_centre() billing_centre()
name district state area cno pin id cb m c bank l
char(array) char(array) char(array) char(array) char(array) long long int int in
t char(2-d array) char array
holds the name of the customer holds the district of the customer holds the stat
e of the customer holds the area of the customer holds the visa card no. of the
customer holds pin number of customers location holds order id accept choice for
bank loop variable switch control variable hold bank names delimiter in user fo
rm

Function name
frontpage() readdata() readdata() readdata() readdata() readdata() readdata() re
addata() readdata() readdata() i,j l
Name int
int
Type
Use
PG 9
loop variable to design frontpage Read length of the extracted line from file of
the calling store Extract price from variable l To put the get point to the def
ault position after looping Stores bill of instantaneous store To accept the val
ue for order confirmation Accept the user code Code part of txt file in int form
To accept choice from category list Looping variable
price pos sum cnf code cd cnum i,j
long long long int int int int int
readdata()
readdata() readdata() readdata() readdata() main() main() main() main()
quan
menu line word ch1 z p nm ch
int
char array char array char array char array int int char array char
Accept quantity of each product
Stores instantaneous category list Extract the line store it from category Extra
ct price from the line and store it To extract code from the line char form Put
get pointer after each bill in output file While loop control variable Store ins
tantaneous dynamic output file name Switch control variable for store selection

PG 10
RETURN TYPE void
FUNCTION NAME blink
FUNCTION DESCRIPTION
Delay execution by printing Loading(using delay loop).
void
frontpage
Print the designed frontpage using file mall.txt.
void
display
Used to print the categories page of western gardens by importing form file catag
ories.txt.
void
billing centre
Store the user transaction details in file payment.txt.
void
readdata
Extract the product from stored text file as per user choice and store details i
n dynamically allocated file. Used to switch between different stores and implem
ent operations accordingly.
-void
main

PG 11

PG 12
/*..............................................................................
.. LIST OF ALL THE HEADER FILES USED ...........................................
.......................................*/ #include <conio.h> #include <iostream.
h> #include <string.h> #include <stdio.h> #include <fstream.h> #include <stdlib.
h> #include <process.h> #include <time.h> //-------------------------------- MAC
ROS----------------------------------------#define pr "*========================
=========* /*_____________________________________________________ THE DESIGN CLA
SS _______________________________________________________*/ class design { //DE
CLARATION OF CLASS VARIABLE public: long double total; //global variable

PG 13
// CONSTRUCTOR IMPLEMENTATION design() { total=0; } /* =========================
==================== FUNCTION PROTOTYPES =======================================
====== */ void display(); void frontpage(); void readdata(ifstream&,ifstream&,if
stream&,fstream&); void blink(); void billing_centre(); }; /* ==================
=========================== FUNCTION DEFINATIONS ===============================
============== */
void design::blink() { system("cls"); //VARIABLE DECLARATIONS ifstream f2; char
ch[1000]; int i=0,j; long len=i,d=0; f2.open("loading.txt",ios::in);

PG 14
while(f2) { ch[i]=(char)f2.get(); i++; } for(i=1;i<=100;i++) { for(j=0;j<=len;j+
+) { cout<<ch[j]; while(d>10000)//delay loop d++; d=0; } cout<<endl<<endl; syste
m("cls"); } f2.close(); }
void design::billing_centre() { char name[20],district[20],state[20],area[20],cn
o[16],pin[6]; long id,pno; int cb=0,m,c,i;
ofstream f1; ifstream f3;
//outstream object //input-stream object
//CALCULATION OF ORDER ID

srand (time(NULL)); id=rand()%9999999+1000000; //generating random number


PG 15
//ASSIGNMENT OF BANK NAMES char bank[7][40]={"State Bank of India","Union Bank o
f India", "Punjab National Bank","Allahabad bank","UCO bank","Axis bank"}; f1.op
en("Payment.txt",ios::out|ios::app); //INPUTS FOR PROCESSING BILL a:system("cls"
); //DEFINING LABEL cout<<"\n\n\t\tUSER DETAILS\n\n"; cout<<"\n\n"<<pr<<"\n\n\t
NAME: ";gets(name);cout<<"\n\n"<<pr; cout<<"\n\n"<<pr<<"\n\n\t STATE: ";gets(sta
te);cout<<"\n\n"<<pr; cout<<"\n\n"<<pr<<"\n\n\t DISTRICT: ";gets(district);cout<
<"\n\n"<<pr; cout<<"\n\n"<<pr<<"\n\n\t AREA: ";gets(area);cout<<"\n\n"<<pr; cout
<<"\n\n"<<pr<<"\n\n\t PHONE NUMBER: ";cin>>pno;cout<<"\n\n"<<pr; cout<<"\n\n"<<p
r<<"\n\n\t PIN CODE: "; //ERROR ANALYSIS FOR PIN CODE for(i=0;i<=5;i++) { pin[i]
=(char)getch(); cout<<pin[i]; if(pin[i]>=48 && pin[i]<=57) continue; else { cout
<<"\n\n"<<pr;

cout<<"\n\nSorry entered wrong please fill the form PG 16 correctly";getch(); st


rcpy(pin,"");strcpy(name,"");strcpy(state,"");strcpy(district,""); strcpy(distri
ct,"");getch(); goto a; } } cout<<"\n\n"<<pr;
getch(); system("cls");blink(); cout<<"\n\n\t\t\tENTER MODE OF PAYMENT:\n\n\n\t"
<<"1.CASH ON DELIVERY(COD)\n\n\t2.VISA\n\n\t"; cin>>c;
//SWITCHING CHOICE switch(c) { //CASH ON DELIVERY OPTION case 1: blink(); cout<<
"\n\n\tYOUR ORDER HAS BEEN PROCESSED" <<"\n\n\tDELIVERY DURATION: 7 DAYS "; cout
<<"\n\tORDER ID: "<<id; cout<<"\n\n\n\t*********THANK YOU FOR SHOPPING**********
***"; break; // VISA case 2: again:system("cls");

blink(); cout<<"\n\tENTER THE BANK NAME \n\n"; cout<<"\n\n\t1.STATE BANK OF INDI


A\n"; cout<<"\n\n\t2.UNION BANK OF INDIA\n"; cout<<"\n\n\t3.PUNJAB NATIONAL BANK
\n"; cout<<"\n\n\t4.ALLAHABAD BANK\n"; cout<<"\n\n\t5.UCO BANK\n"; cout<<"\n\n\t
6.AXIS BANK \n\n\t"; cin>>cb; //ERROR ANALYSIS FOR BANK SELECTION if((cb>6)||(cb
<0)) //if condition does not match goto again; system("cls");
PG 17
blink();//card details cout<<"\n\n\t"<<bank[cb-1]<<"\n\n"; cout<<"\n\tEnter your
card number(16 digit): "; for(i=0;i<=15;i++) { cno[i]=(char)getch(); if((i<=12
&& i>0) && (i==3 || i==7 || i==11)) cout<<cno[i]<<"-"; else cout<<cno[i]; } //AC
CEPTING SECURED BANK DETAILS (PASSWORD MODE) cout<<"\n\n\tEnter your CVV number(
3 digit): "; for(m=0;m<=2;m++) { getch();cout<<"*"; } cout<<"\n\n\tEnter your pa
ssword(8-digit): " ;

for(m=0;m<=7;m++) { getch();cout<<"*"; } cout<<endl; system("cls"); blink();


PG 18
cout<<"\n\n\tYOUR ORDER HAS BEEN PROCESSED"; cout<<"\n\tRs."<<total<<" HAS BEEN
DEDUCTED FROM YOUR <<ACCOUNT"; cout<<"\n\tORDER ID: "<<id; cout<<"\n\n\n\t******
***THANK YOU FOR SHOPPING*************"; break;
default: cout<<"\n\tWRONG CHOICE"; } //PRINTING DETAILS TO FILE f1<<"\n PAYMENT
DETAILS\n"; f1<<"\n\tNAME: "<<name; f1<<"\n\tSTATE: "<<state; f1<<"\n\tDISTRICT:
"<<district; f1<<"\n\tAREA: "<<area;

f1<<"\n\tPIN: "<<pin; f1<<"\n\tPHONE NUMBER : "<<pno; if(c==2) { f1<<"\n\tPAYMEN


T MODE: VISA"; f1<<"\n\tBANK NAME: "<<bank[cb-1]; f1<<"\n\tCARD NUMBER: "; for(m
=0;m<15;m++) { if((m>=0&&m<=1)||(m>=13 && m<=15)) f1<<cno[m]; else f1<<"x"; } }
else { f1<<"\n\tPAYMENT MODE: COD"; f1<<"\n\tTOTAL BILL: "<<total; f1<<"\n\tORDE
R ID: "<<id;
PG 19
f1<<"\n\t"<<pr; f1.close();
} }
void design::frontpage()

{ ifstream obj; obj.open("mall.txt"); while(!obj.eof()) cout<<(char)obj.get(); o


bj.close(); getch(); }
PG 20
void design::display() { system("cls"); ifstream obj; obj.open("catagories.txt")
; while(!obj.eof()) cout<<(char)obj.get(); obj.close(); cout<<"\n\t PLEASE ENTER
YOUR CHOICE [single digit] \t"; } void design::readdata(ifstream& obj,ifstream&
obj0,ifstream& fpage,fstream& obj1) { long price,pos ; int cnf,cd,code=0,cnum=1,i,j,quan,l; //VARIABLE DECLARATIONS
long double sum=0; char menu[1500],line[1500],word[6],ch1[3],x[3000]; //DISPLAYI
NG FRONTPAGE OF EACH INDIVIDUAL STORE system("cls");

while(!fpage.eof()) cout<<(char)fpage.get(); getch(); system("cls");


PG 21
// EXTRACTION UPTO CATEGORY FROM THE INPUT FILE obj.getline(x,3000, + ); pos=obj
.tellg(); STORE IT //ASSIGN THIS POSITION AS DEFAULT AND
//PRINTING TABULAR BILL TO FILE obj1<<"\n\tCODE\tNAME\t\t\t\tUNIT-PRICE\tQUANTIT
Y\n"; //SELECTION IN CATEGORY AND LOOPING IT while(cnum!=0) { //PRINTING THE CAT
EGORY FROM FILE TO SCREEN system("cls"); puts(x); cout<<"\n\t Please Enter the C
ategory Number (0 to Exit) \n\n\t "; cin>>cnum; if(cnum==0) break; //ERROR ANALY
SIS FOR CATEGORY NUMBER if(cnum>6) { cout<<"\n\t Sorry Wrong Catagory !! Kindly
Visit the store once again "; break; } //SHIFTING POINTER TO DEFAULT LOCATION IN
INPUT FILE

obj.seekg(pos);
PG 22
//EXTRACTING THE CATEGORY DETAILS OF USER S CHOICE for(i=1;i<cnum;i++) obj.getli
ne(menu,1500, # ); obj0.seekg(obj.tellg()); obj.getline(menu,1500, # ); //CODE F
OR MUTIPLE ORDERS IN CATEGORY PRODUCTS while(!obj0.eof()) { system("cls"); cout<
<"\n\t Info : Press The Code To Order "; cout<<"\n\t : Press 0 - To Go to Catago
ries Menu \n\n"; //PRINTING THE CATEGORY DETAILS AND ASKING CHOICE cout<<menu<<"
\n\t"; cout<<"\n\t|_CODE_|:-> \t"; //asking code cin>>code; if(code==0) break; /
/ TO GOTO CATEGORY MENU obj0.seekg(pos); //CHANGING POINTER POSITION TO DEFAULT
//============================================== //MATCHING USER CODES WITH CODE
S IN INPUT FILES //==============================================
while(!obj0.eof()) { obj0.getline(line,1500, . ); for(int j=0;j<3;j++) ch1[j]=li
ne[j];
//code is extracted

cd=atoi(ch1) ; //EXTRACTING THE ITEM LINE FROM FILE


PG 23
if(cd==code) { l=strlen(line); cout<<"\n\t|_QUANTITY_|:-> "; //asking quantity c
in>>quan; cout<<"\n\t Ordered :"; cout<<"\n\n\tCODE\tNAME\t\t\t\tUNIT-PRICE\tQUA
NTITY \n\n\t"; cout.write(line,l);cout<<"\t\t"<<quan; //CONFIRMATION OF ORDER co
ut<<"\n\n\n\t TO CONFIRM ORDER PRESS 1\n\t "; cin>>cnf; if(cnf!=1) { cout<<"\n\t
ORDER CANCELLED "; getch(); break; } for(j=0;j<5;j++) word[j]=line[l-5+j]; pric
e=quan*atoi(word); sum=sum+price; total=total+sum; obj1<<"\n\t"; obj1.write(line
,l);obj1<<"\t\t"<<quan; cout<<"\n\t ORDER CONFIRMED "; getch(); break; } } if(co
de!=cd) //ERROR ANALYSIS FOR ITEM CODE

PG 24
{ cout<<"\n\t Sorry Wrong Code Entered Please Visit the store once again"; getch
(); break ; } } //CONDITION FOR SUCCESSFUL ORDER if(code!=0) break; } if(sum==0)
obj1<<"\n\t NOTHING IS BOUGHT FROM THIS STORE "; obj1<<"\n\n\t Your Total Bill
From This Store : "<<sum; } /*__________________________________________________
_ THE MAIN FUNCTION _______________________________________________________*/ vo
id main() { int z=0,p=1; //variables char nm[20],ch; ifstream obj,obj0; fstream
obj1; //CONCEPT IMPLEMENTATION FOR DYNAMIC FILE NAME ALLOCATION cout<<"\n\t Plea
se view in full screen \n\n\t Enter Username :\n\n\t "; gets(nm); strcat(nm,".tx
t"); //file object declarations

obj1.open(nm,ios::app);
//output object declaration
PG 25
//FRONTPAGE DESIGN FUNCTION system("cls"); design d; //frontpage design d.frontp
age(); //INTIALIZING THE OUTPUT FILE WITH MALL NAME obj1<<"\n\n\t"<<pr; obj1<<"\
n\n\n\t\t THE WESTERN GARDENS SHOPPING ARCADE \n\n"; //storing info in file obj1
<<"\n\t\t YOU VISITED THE FOLLOWING STORES : \n\n"; //LOOPING FOR SWITCHING STOR
ES while(p==1) { //DISPLAY OF THE IN-THE-MALL MENU d.display(); cin>>ch; // aski
ng the choice switch(ch) { case 1 : { system("cls"); ifstream abt; abt.open("a
bout.txt"); while(!abt.eof()) cout<<(char)abt.get(); getch(); break; } case 2
: //electronics

{ ifstream store; store.open("gstore.txt"); obj0.open("electronics.txt"); obj.op


en("electronics.txt"); obj1.close(); fstream obj1; obj1.open(nm,ios::app); obj1.
seekg(z); obj1<<"\n\n\t GADGETOMANIA\n"; d.readdata(obj,obj0,store,obj1); z=obj1
.tellp(); store.close(); break; }
PG 26
case 3 : //market { ifstream store; store.open("mstore.txt"); obj0.open("marke
t.txt"); obj.open("market.txt"); obj1.close(); fstream obj1; obj1.open(nm,ios::a
pp); obj1.seekg(z); obj1<<"\n\n\t THE WESTERN MARKETS\n"; d.readdata(obj,obj0,st
ore,obj1); z=obj1.tellp(); store.close(); break; }
case 4 : { ifstream store;
//book store

store.open("bstore.txt"); obj0.open("books.txt"); obj.open("books.txt"); obj1.cl


ose(); fstream obj1; obj1.open(nm,ios::app); obj1.seekg(z); obj1<<"\n\n\t A PAGE
AND INK \n"; d.readdata(obj,obj0,store,obj1); z=obj1.tellp(); store.close(); br
eak;
PG 27
} case 5 : //bill payment { int mode; system("cls"); if(d.total==0) { cout<<"\
n\t Sorry Your Cart is Empty";break; } obj1.close(); ifstream obj1; obj1.open(nm
); while(obj1) cout<<(char)obj1.get(); cout<<"\n\n\t YOUR TOTAL BILL FROM ALL TH
E STORES => " <<d.total<<"\n\n\n\t"<<pr; cout<<"\n\n\t Please 1 to Proceed Payin
g Bill \n" <<"\t\t2 to save your bill in Wishlist mode and exit\n\t "; cin>>mode
; if(mode==2) { cout<<"\n\t WISHLIST SAVED IN HARD-DISK"; }

else if(mode==1) d.billing_centre(); else cout<<"\n\t WRONG CHOICE !!"; break; }


PG 28
case 6 : { exit(0); } default : { cout<<"\n\t Wrong Choice .. Press any Key to
continue Again"; getch(); system("cls"); break; } } //CLOSING THE FILES obj0.cl
ose(); obj1.close(); obj.close();
cout<<"\n\n\t Press 1- WESTERN GARDENS CATALOGUE" <<"\n\t OR ANY OTHER KEY TO EX
IT FROM MALL\n\t "; cin>>p; if(p!=1) exit(0); } }

PG 29

PG 30

PG 31

PG 32

PG 33

PG 34

PG 35

PG 36

PG 37

PG 38

PG 39
ASCII ARTS:
WWW.NETWORK-SCIENCE.DE WWW.PATORJK.COM
LOGO :
WWW.FLAMINGTEXT.COM WWW.COOLTEXT.COM
SUMITA ARORA C++ VOL 1,2

Anda mungkin juga menyukai