Вы находитесь на странице: 1из 31

Downl

oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

COMPUTERSCIENCE
PROJECTFILE
ON
BOOK-SHOP

PROJECTPREPAREDBY:
AshishKumar
XII
Session:
2009-2010
EwingChrist
ianPubl
icSeni
orSecondar
y
School

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

TABLEOFCONTENTS

Cer
ti
fi
cat
e

Acknowl
edgement

Headerf
il
esandt
hei
rpur
pose

Codi
ng

Li
mit
ati
ons

Requi
rement
s

Bi
bli
ogr
aphy

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

Acknowl
edgement
It hankmyComput erSci
encet eacher
Miss.Rupal iJaiswalforguidanceandsuppor t.
Ialsot hankmyPr i
ncipalMrs.S.Chand.Iwoul d
al
sol iket othankmypar entsandmysi st
erfor
encour agingmedur ingthecour seoft his
project.FinallyIwouldl i
ketothankCBSEf or
givi
ngmet hisoppor t
unitytoundertaket his
project.

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

Cer
ti
fi
cat
e
Thi
sistocert
if
yt hatAshi
shKumarof
classtwelv
e,EwingChr i
sti
anpublicSenior
SecondarySchool,
Allahabadhassuccessf ul
ly
compl et
edhisproj
ectincomput erpracti
cals
fortheAISSCEasprescr i
bedbyCBSEi nthe
year2008-2009.

Dat
e:

Regi
str
ati
onNo.:

Signat
ureofI
nter
nal Signat
ureofExt
ernal
Examiner Examiner

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

_
___
___
___
___
___
__ _
___
___
___
___
___
__

HEADERFI
LESUSEDAND
THEI
RPURPOSE

1.FSTREAM.
H–f
orf
il
ehandl
i
ng,
cinandcout

2.PROCESS.
H–f
orexi
t(
)funct
ion

3.CONI
O.H–f
orcl
rscr
()andget
ch(
)funct
ions

4.STDI
O.H–f
orst
andar
dI/
Ooper
ati
ons

5.STRI
NG.
H–f
orst
ri
nghandl
i
ng

6.CTYPE.
H–f
orchar
act
erhandl
i
ng

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

CODI
NG

#i
ncl
ude<f
str
eam.
h>
#i
ncl
ude<coni
o.h>
#i
ncl
ude<st
ri
ng.
h>
#i
ncl
ude<pr
ocess.
h>
#i
ncl
ude<st
dio.
h>
#i
ncl
ude<ct
ype.
h>
cl
asssubj
ect
{

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

publ
i
c:
chars[
5][
40]
,
sub[
5][
5][
40]
;
subj
ect
()
{
st
rcpy
(sub[
0][
0],
"Phy
sicsNCERT-
I"
);
st
rcpy
(sub[
0][
1],
"Phy
sicsNCERT-
II
")
;
st
rcpy
(sub[
0][
2],
"Pr
adeepPhy
sics"
);
st
rcpy
(sub[
0][
3],
"H.
C.Ver
ma\
t")
;
st
rcpy
(sub[
0][
4],
"Toget
herWi
th"
);
st
rcpy
(sub[
1][
0],
"Chemi
str
yNCERT-
I"
);
st
rcpy
(sub[
1][
1],
"Chemi
str
yNCERT-
II
")
;
st
rcpy
(sub[
1][
2],
"Pr
adeepChemi
str
y")
;
st
rcpy
(sub[
1][
3],
"Toget
herWi
th"
);
st
rcpy
(sub[
1][
4],
"P.
Bahaadur
\t"
);
st
rcpy
(sub[
2][
0],
"Mat
hsNCERT-
I"
);
st
rcpy
(sub[
2][
1],
"Mat
hsNCERT-
II
")
;
st
rcpy
(sub[
2][
2],
"Mat
hsND-
I\
t")
;
st
rcpy
(sub[
2][
3],
"Mat
hsND-
II
")
;
st
rcpy
(sub[
2][
4],
"R.
D.Shar
ma\
t")
;
st
rcpy
(sub[
3][
0],
"Fl
emi
ngoText
book"
);
st
rcpy
(sub[
3][
1],
"Vi
stasText
book"
);
st
rcpy
(sub[
3][
2],
"Fl
emi
ngoND"
);
st
rcpy
(sub[
3][
3],
"Vi
stasND\
t")
;
st
rcpy
(sub[
3][
4],
"Gol
denGui
de"
);
st
rcpy
(sub[
4][
0],
"Sumi
taAr
ora"
);

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

st
rcpy
(sub[
4][
1],
"Toget
herWi
th"
);
st
rcpy
(sub[
4][
2],
"Ev
ergr
eenC++"
);
st
rcpy
(sub[
4][
3],
"Rohi
tQuest
ionBank"
);
st
rcpy
(sub[
4][
4],
"Osbor
ne\
t")
;
st
rcpy
(s[
0],
"Phy
sics\
t")
;
st
rcpy
(s[
1],
"Chemi
str
y\t
");
st
rcpy
(s[
2],
"Mat
hs\
t")
;
st
rcpy
(s[
3],
"Engl
i
sh\
t")
;
st
rcpy
(s[
4],
"Comput
erSci
ence"
);

}
}
;
v
oidshow(
);
v
oidshow2(
);
cl
assuser
li
st
{
publ
i
c:
i
ntno;
charuser
s[100]
[50]
;
}
;
cl
assuser
{
publ
i
c:
i
ntsbj
[5]
[7]
,
tot
p,t
otr
;
charpasswor
d[20]
;

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

v
oidshowpb(
)
{
cout
<<"
\n\
n\n\
n\n\
n'P'
Pur
chase\
n'B'
Back"
;
}
}
;
v
oidupper
case(
char*
);
v
oidpur
_ret
(charname[
])
;
v
oidnot
if
icat
ion(
user&)
;
v
oidset
def
aul
t(
user&)
;
v
oidchkusr
lst
();
v
oidchkbookl
st(
);
v
oidshowuser
li
st(
);
i
ntcr
tusr
();
i
ntshowbooks(
);
i
ntopenacc(
);
v
oidnamecut
ter
(charname[
])
;
i
ntmai
n()
{
t
ext
backgr
ound(
3);
t
ext
col
or(
0);
chkusr
lst
();
chkbookl
st(
);
mpage:
cl
rscr
();
charch;

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

cout
<<"
\n\
n\t
\t\
tWel
comeToASHI
SH
BOOKSHOP\
n\n\
n\n\
n'1'
Seet
he"
;
cout
<<"
li
stsofbooks\
n'2'
Creat
eanaccount
\n'
3'Openan
account
";
cout
<<"
\n'
4'Seeaboutno.ofbookspur
chased/
ret
urned\
n";
cout
<<"'
5'Seet
hel
i
stofaccount
s\n'
6'Qui
t"
;show(
);
ch=get
ch(
);
swi
tch(
ch)
{
case'
1'
:i
f(
showbooks(
)==1)
{got
ompage;
}
br
eak;
case'
2'
:cr
tusr
();
got
ompage;
case'
3'
:openacc(
);
got
ompage;
case'
4'
:pur
_ret
("
BOOKLI
ST"
);
got
ompage;
case'
5'
:showuser
li
st(
);
got
ompage;
case'
6'
:ret
urn0;
def
aul
t:got
ompage;
}
get
ch(
);

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

r
etur
n0;
}
i
ntcr
tusr
()
{
cl
rscr
();
charname[
50]
,
repl
y;
i
fst
ream f
i;
useru;
user
li
stl
i
st;
f
i.
open(
"USERLI
ST"
);
fi
.r
ead(
(char*
)
&l
i
st,
si
zeof
(l
ist
));
fi
.cl
ose(
);
i
f(
li
st.
no==99)
{cl
rscr
();
cout
<<"
\n\
tYoucan'
tcr
eat
eanyaccount
.\n\
t";
cout
<<"
Sincet
heaccout
nli
sti
sful
l
,\n\
tsoy
ouhav
eto"
;
cout
<<"del
eteanaccount
";
show2(
);
get
ch(
);
ret
urn0;
}
cout
<<"
\nEnt
ery
ourname(
max49char
act
ers)
:\n"
;
page2:
ci
n.get
li
ne(
name,
49)
;upper
case(
name)
;
i
f(
name[
0]=='
\0'
|
|name[
0]=='
')
{
cl
rscr
();
cout
<<"
\nPl
easeent
erav
ali
dname:
";
got
opage2;
}
f
or(
inti
=0;
name[
i]
!='
\0'
;
i++)
{

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

i
f(
name[
i]
=='
\\
'|
|name[
i]
=='
/'
|
|name[
i]
=='
:
'|
|name[
i]
=='
*'
||
name[
i
]=='
?'
||
name[
i]
=='
\"
'|
|
name[
i]
=='
<'
||
name[
i]
=='
>'
||
name[
i]
=='
|
')
{cl
rscr
();
cout
<<"
\nPl
easeent
erav
ali
dname:
";
got
opage2;
}
}
f
i.
open(
name)
;
i
f(
fi
.good(
))
{
cl
rscr
();
cout
<<"
\nThenamey
ouhav
eent
eredi
sal
readypr
esent
!"
;
cout
<<"
\nPl
easeent
eranot
her
:\
n";
got
opage2;
}
f
i.
close(
);
page:cl
rscr
();
cout
<<"
\nDoy
ouwantt
oaddapasswor
d?
(
y/n)
:"
;r
epl
y=get
ch(
);
i
f(
repl
y=='
Y'
||
repl
y=='
y'
)
{cl
rscr
();
cout
<<"
\nEnt
ery
ourpasswor
d(max19char
act
ers)
:\n"
;
ci
n.get
li
ne(
u.passwor
d,19)
;
}
el
sei
f(
repl
y=='
N'|
|
repl
y=='
n'
)
{st
rcpy
(u.
passwor
d,"
########"
);
}

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

el
se{got
opage;
}
set
def
aul
t(
u);
of
str
eam f
o(name)
;
f
o.wr
it
e((
char*
)&u,
si
zeof
(u)
);
fo.
close(
);
st
rcpy
(li
st.
user
s[l
i
st.
no]
,
name)
;l
ist
.no++;
f
o.open(
"USERLI
ST"
);
fo.
wri
te(
(char*
)
&l
i
st,
si
zeof
(l
ist
));
fo.
close(
);
cl
rscr
();
cout
<<"
\n\
n\t
Congr
atul
ati
ons!"
;
cout
<<"
Youhav
ecr
eat
edy
ouraccountof
name:
\n\
t'
"<<name<<"
'
";
show2(
);
get
ch(
);
r
etur
n0;
}
v
oidset
def
aul
t(
user&usr
)
{
i
nti
,
j;
f
or(
i=0;
i
<5;
i
++)
{
f
or(
j=0;
j
<7;
j
++)
{
usr
.sbj
[i
][
j]
=0;
}
}
usr
.t
otp=0;
usr
.t
otr
=0;
}

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

v
oidchkusr
lst
()
{
i
fst
ream usr
lst
;
usr
lst
.open(
"user
li
st"
);
i
f(
!usr
lst
.good(
))
{
of
str
eam f
o("
user
li
st"
);
user
li
stl
i
st;
l
i
st.
no=0;
f
o.wr
it
e((
char*
)&l
i
st,
si
zeof
(l
ist
));
f
o.cl
ose(
);
}
usr
lst
.cl
ose(
);
}
v
oidchkbookl
st(
)
{
i
fst
ream bookl
st;
i
nti
,
j;
bookl
st.
open(
"bookl
i
st"
);
i
f(
!bookl
st.
good(
))
{
of
str
eam f
o("
bookl
i
st"
);
userbkl
st;
f
or(
i=0;
i
<5;
i
++)
{
f
or(
j=0;
j
<5;
j
++)

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

{
bkl
st.
sbj
[i
][
j]
=1000;
}
}
f
or(
i=0;
i
<5;
i
++)
{
bkl
st.
sbj
[i
][
5]=0;
bkl
st.
sbj
[i
][
6]=0;
}
bkl
st.
tot
p=0;
bkl
st.
tot
r=0;
f
o.wr
it
e((
char*
)&bkl
st,
si
zeof
(bkl
st)
);
f
o.cl
ose(
);
}
bookl
st.
close(
);
}
i
ntshowbooks(
)
{
userguest
;subj
ectsb;
chari
,
k,ch,
ch1,
ch2;
i
ntx,
y,
j;
page1:cl
rscr
();
i
fst
ream f
i(
"Bookl
i
st"
);
f
i.
read(
(char*
)&guest
,si
zeof
(guest
));
f
i.
close(
);
cout
<<"
\n\
n\n\
n\n\
n\n"
;
f
or(
x=0;
x<5;
x++)
{
cout
<<"'
"
<<x+1<<"
'"<<sb.
s[x]
<<"
\n"
;
}

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

cout
<<"'
B'Back"
;
show(
);
ch=get
ch(
);
f
or(
i='
1'
,x=0;
i
<='
5'
;i
++,
x++)
{
page2:cl
rscr
();
i
f(
ch==i
)
{
cout
<<"
\n\
n\n\
t\t
"<<sb.
s[x]
<<"
\n\
n\n\
n";
f
or(
j=0;
j
<5;
j
++)
{
cout
<<"\
'"
<<j
+1<<"
\'"
<<sb.
sub[
x][
j]
<<"
\t"
;
cout
<<guest
.sbj
[x]
[j
]<<"r
emai
ning\
n";
}
cout
<<"'
B'Back"
;show(
);
ch1=get
ch(
);
f
or(
k='
1'
,y
=0;
k<='
5'
;k++,
y++)
{
i
f(
ch1==k)
{
page3:cl
rscr
();
cout
<<"
\n\
t\t
\t\
t"<<sb.
sub[
x][
y];
guest
.showpb(
);
show(
);
ch2=get
ch(
);
i
f(
ch2=='
P'
||
ch2=='
p'
)
{
i
f(
guest
.sbj
[x]
[y]
>0)
{guest
.t
otp++;
guest
.sbj
[x]
[5]
++;
guest
.sbj
[x]
[y]
--
;

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

not
if
icat
ion(
guest
);
}
el
se
{
cl
rscr
();
cout
<<"
\n\
n\t
Youcan'
tpur
chaset
hisbook.
\n\
tMake"
;
cout
<<"
sur
ethatno.ofcopi
esoft
hisbook\
n\t
in"
;
cout
<<"
thi
sshopi
sgr
eat
ert
hanzer
o."
;
show2(
);
get
ch(
);
got
opage2;
}
}
el
sei
f(
ch2=='
B'
||
ch2=='
b'
){got
opage2;
}
el
se{got
opage3;
}
br
eak;
}
}
i
f(
ch1=='
B'
||
ch1=='
b'
){got
opage1;
}
el
se{got
opage2;
}
}
}
i
f(
ch=='
B'
||
ch=='
b'
){r
etur
n1;
}
el
se{got
opage1;
}
}
v
oidnot
if
icat
ion(
user&u)
{

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

cl
rscr
();
of
str
eam f
("BOOKLI
ST"
);
f
.wr
it
e((
char*
)&u,
si
zeof
(u)
);
f
.cl
ose(
);
cout
<<"
\n\
n\n\
n\n\
n\n\
tThanky
ouf
ory
ourpur
chasi
ngt
his
book."
;
cout
<<"
Nextt
imey
oumustcr
eat
e\n\
tanaccountsot
hat
y
oucan"
;
cout
<<"
pur
chasemor
ethanonebookandal
so
can\
n\t
ret
urnbooks"
;
cout
<<"pur
chasedf
rom t
hisshop.
\n\
n\n\
n\n"
;
cout
<<"
\tNowpr
essanykeyt
oexi
t"
;
get
ch(
);
exi
t(
0);
}
v
oidshow(
)
{
cout
<<"
\n\
n\n\
n\n\
tPr
essanyoft
hekey
sgi
venabov
e!"
;
}
v
oidshow2(
)
{
cout
<<"
\n\
n\n\
n\n\
tPr
essanykeyt
oback!
";
}
v
oidpur
_ret
(charname[
])
{

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

cl
rscr
();
useru;
subj
ects;
i
fst
ream f
i(
name)
;i
nti
;
f
i.
read(
(char*
)&u,
si
zeof
(u)
);
fi
.cl
ose(
);
cout
<<"
\n\
n\n\
nSubj
ect
\t\
tPur
chased\
tRet
urned\
n\n\
n";
f
or(
i=0;
i
<5;
i
++)
{
cout
<<""
<<i
+1<<"
."
<<""
<<s.
s[i
]<<"
\t"
<<u.
sbj
[i
][
5];
cout
<<"
\t\
t"<<u.
sbj
[i
][
6]<<"
\n"
;
}
cout
<<"6.
"
<<"
Tot
al\
t\t
"<<u.
tot
p<<"
\t\
t"<<u.
tot
r;
show2(
);
get
ch(
);
}
i
ntopenacc(
)
{
useru,
bkl
st;
user
li
stl
i
st;
charname[
50]
,
passw[
20]
,
repl
y;
ofst
ream f
o;
page1:
clr
scr
();
cout
<<"
\nEnt
ery
ouraccountname:
\n
"
;ci
n.get
li
ne(
name,
49)
;
upper
case(
name)
;i
fst
ream f
i(
name)
;
i
f(
!f
i.
good(
))
{pagename:
cl
rscr
();
cout
<<"
\n\
nWr
ongaccountname!
\nEnt
er
agai
n?(
y/n)
\n"
;
r
epl
y=get
ch(
);

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

i
f(
repl
y=='
y'
||
repl
y=='
Y'
){got
opage1;
}
el
sei
f(
repl
y=='
n'
||
repl
y=='
N')
{ret
urn0;
}
el
se{got
opagename;
}
}
f
i.
read(
(char*
)&u,
si
zeof
(u)
);
fi
.cl
ose(
);
f
i.
open(
"USERLI
ST"
);
fi
.r
ead(
(char*
)
&l
i
st,
si
zeof
(l
ist
));
fi
.cl
ose(
);
i
ntf
lag=0;
f
or(
ints=0;
s<l
i
st.
no;
s++)
{
i
f(
!st
rcmp(
name,
l
ist
.user
s[s]
))
{fl
ag=1;
break;
}
}
i
f(
fl
ag==0)
{st
rcpy
(li
st.
user
s[l
i
st.
no]
,
name)
;l
ist
.no++;
f
o.open(
"USERLI
ST"
);
f
o.wr
it
e((
char*
)&l
i
st,
si
zeof
(l
ist
));
fo.
close(
);
}
i
f(
!st
rcmp(
u.passwor
d,"
########"
)){got
opage3;
}
page2:
clr
scr
();
cout
<<"
\nEnt
ery
ourpasswor
d:\
n";
ci
n.get
li
ne(
passw,
19)
;
i
f(
str
cmp(
u.passwor
d,passw)
)
{pagepass:
cl
rscr
();
cout
<<"
\n\
nWr
ongpasswor
d!\
nEnt
eragai
n?(
y/n)
\n
"
;
r
epl
y=get
ch(
);

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

i
f(
repl
y=='
y'
||
repl
y=='
Y'
){got
opage2;
}
el
sei
f(
repl
y=='
n'
||
repl
y=='
N')
{ret
urn0;
}
el
se{got
opagepass;
}
}
page3:
clr
scr
();
fi
.open(
"BOOKLI
ST"
);
f
i.
read(
(char*
)&bkl
st,
si
zeof
(bkl
st)
);
fi
.cl
ose(
);
cout
<<"
\n\
n\n\
tWel
come"
<<name;
cout
<<"
\n\
n\n\
n'1'
Pur
chase/
ret
urnbooks\
n'2'
No.of
books"
;
cout
<<"y
ouar
ehav
ing\
n'3'
No.ofbooks
pur
chased/
ret
utned"
;
cout
<<"
byy
ou\
n'4'
Add/
modi
fypasswor
d\n'
5'Remov
e
passwor
d\n"
;
cout
<<"
'
6'Del
etey
ouraccount
\n'
B'
Back"
;show(
);
repl
y=get
ch(
);
i
f(
repl
y=='
1'
)
{
subj
ectsb;
chari
,
k,ch,
ch1,
ch2;
i
ntx,
y,
j;
page31:cl
rscr
();
cout
<<"
\n\
n\n\
n\n\
n\n"
;
f
or(
x=0;
x<5;
x++)
{
cout
<<"'
"
<<x+1<<"
'"<<sb.
s[x]
<<"
\n"
;
}
cout
<<"'
B'Back"
;

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

show(
);
ch=get
ch(
);
f
or(
i='
1'
,x=0;
i
<='
5'
;i
++,
x++)
{
page32:cl
rscr
();
i
f(
ch==i
)
{
cout
<<"
\n\
n\n\
t\t
"<<sb.
s[x]
<<"
\n\
n\n\
n";
f
or(
j=0;
j
<5;
j
++)
{
cout
<<"\
'"
<<j
+1<<"
\'"
<<sb.
sub[
x][
j]
<<"
\t"
;
cout
<<bkl
st.
sbj
[x]
[j
]<<"r
emai
ning\
n";
}
cout
<<"'
B'Back"
;show(
);
ch1=get
ch(
);
f
or(
k='
1'
,y
=0;
k<='
5'
;k++,
y++)
{
i
f(
ch1==k)
{
page33:cl
rscr
();
cout
<<"
\n\
t\t
\t\
t"<<sb.
sub[
x][
y];
u.
showpb(
);
cout
<<"
\n'
R'Ret
urn"
;show(
);
ch2=get
ch(
);
i
f(
ch2=='
P'
||
ch2=='
p'
)
{
i
f(
bkl
st.
sbj
[x]
[y]
>0)
{
u.
tot
p++;
bkl
st.
tot
p++;
u.sbj
[x]
[5]
++;
bkl
st.
sbj
[x]
[5]
++;

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

u.
sbj
[x]
[y]
++;
bkl
st.
sbj
[x]
[y]
--
;f
o.open(
"BOOKLI
ST"
);
f
o.wr
it
e((
char*
)&bkl
st,
si
zeof
(bkl
st)
);
fo.
close(
);
f
o.open(
name)
;f
o.wr
it
e((
char*
)&u,
si
zeof
(u)
);
fo.
close(
);
cl
rscr
();
cout
<<"
\n\
n\t
OK!Youhav
epur
chasedt
hisbook"
;
}
el
se
{
cl
rscr
();
cout
<<"
\n\
n\t
Youcan'
tpur
chaset
hisbook.
\n\
tMake"
;
cout
<<"
sur
ethatno.ofcopi
esoft
hisbook\
n\t
in"
;
cout
<<"
thi
sshopi
sgr
eat
ert
hanzer
o."
;
}
show2(
);
get
ch(
);
got
opage32;
}
el
sei
f(
ch2=='
r'
|
|ch2=='
R'
)
{
i
f(
u.sbj
[x]
[y]
>0)
{
u.
tot
r++;
bkl
st.
tot
r++;
u.sbj
[x]
[6]
++;
bkl
st.
sbj
[x]
[6]
++;
u.
sbj
[x]
[y]
--
;bkl
st.
sbj
[x]
[y]
++;
fo.
open(
"BOOKLI
ST"
);
f
o.wr
it
e((
char*
)&bkl
st,
si
zeof
(bkl
st)
);
fo.
close(
);
f
o.open(
name)
;f
o.wr
it
e((
char*
)&u,
si
zeof
(u)
);
fo.
close(
);
cl
rscr
();
cout
<<"
\n\
n\t
OK!Youhav
eret
urnedt
hisbook"
;
}

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

el
se
{
cl
rscr
();
cout
<<"
\n\
n\t
Youcan'
tret
urnt
hisbook.
\n\
tMake"
;
cout
<<"
sur
ethatno.ofcopi
esoft
hisbook\
n\t
you"
;
cout
<<"ar
ehav
ingi
sgr
eat
ert
hanzer
o."
;
}
show2(
);
get
ch(
);
got
opage32;
}
el
sei
f(
ch2=='
B'
||
ch2=='
b'
){got
opage32;
}
el
se{got
opage33;
}
}
}
i
f(
ch1=='
B'
||
ch1=='
b'
){got
opage31;
}
el
se{got
opage32;
}
}
}
i
f(
ch=='
B'
||
ch=='
b'
){got
opage3;
}
el
se{got
opage31;
}
}
el
sei
f(
repl
y=='
2'
)
{
cl
rscr
();
i
nti
,
j;

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

f
or(
i=0;
i
<5;
i
++)
{subj
ectsb;
cout
<<"
\n"
<<sb.
s[i
]<<"
\n"
;
f
or(
j=0;
j
<5;
j
++)
{
cout
<<""
<<j
+1<<"
."<<sb.
sub[
i]
[j
]<<"
\t"
<<u.
sbj
[i
][
j]
;
cout
<<"r
emai
ning\
n";
}

}
show2(
);
get
ch(
);
got
opage3;
}
el
sei
f(
repl
y=='
3'
)
{pur
_ret
(name)
;
got
opage3;
}
el
sei
f(
repl
y=='
4'
)
{cl
rscr
();
cout
<<"
\nEnt
ernewpasswor
d(max19
char
act
ers)
:\
n";
ci
n.get
li
ne(
passw,
19)
;st
rcpy
(u.
passwor
d,passw)
;cl
rscr
();
cout
<<"
\n\
tPasswor
dmodi
fi
ed
succesf
ull
y!
";
show2(
);
get
ch(
);
f
o.open(
name)
;f
o.wr
it
e((
char*
)&u,
si
zeof
(u)
);
fo.
close(
);
got
opage3;
}

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

el
sei
f(
repl
y=='
5'
)
{page35:cl
rscr
();
cout
<<"
\nRemov
e
passwor
d?(
y/n)
:"
;r
epl
y=get
ch(
);
i
f(
repl
y=='
Y'
||
repl
y=='
y'
)
{st
rcpy
(u.
passwor
d,"
########"
);
fo.
open(
name)
;
f
o.wr
it
e((
char*
)&u,
si
zeof
(u)
);
fo.
close(
);
cl
rscr
();
cout
<<"
\n\
tPasswor
dremov
edsuccessf
ull
y!
";
show2(
);
get
ch(
);
got
opage3;
}
el
sei
f(
repl
y=='
N'|
|
repl
y=='
n'
){got
opage3;
}
el
se{got
opage35;
}
}
el
sei
f(
repl
y=='
6'
)
{page36:cl
rscr
();
cout
<<"
\nDoy
ouwantt
odel
etey
our
account
?(y
/n)
:"
;r
epl
y=get
ch(
);
i
f(
repl
y=='
Y'
||
repl
y=='
y'
)
{cl
rscr
();
remov
e(name)
;
cout
<<"
\n\
tYouraccounti
sdel
eted
successf
ull
y!
";
show2(
);
get
ch(
);
namecut
ter
(name)
;
r
etur
n0;
}
el
sei
f(
repl
y=='
N'|
|
repl
y=='
n'
){got
opage3;
}
el
se{
got
opage36;
}

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

}
el
sei
f(
repl
y=='
b'
||
repl
y=='
B'
)
{page3b:cl
rscr
();
cout
<<"
\nDoy
ouwantt
oexi
tfr
om y
ouraccount
?(y
/n)
:"
;
r
epl
y=get
ch(
);
i
f(
repl
y=='
Y'
||
repl
y=='
y'
){r
etur
n0;
}
el
sei
f(
repl
y=='
N'|
|
repl
y=='
n'
){got
opage3;
}
el
se{got
opage3b;
}
}
el
se{got
opage3;
}
}
v
oidupper
case(
char*
a)
{
f
or(
inti
=0;
a[i
]!
='
\0'
;
i++)
{
a[
i]
=toupper
(a[
i]
);
}
}
v
oidshowuser
li
st(
)
{
cl
rscr
();
i
nti
;
user
li
stl
i
st;
i
fst
ream f
i(
"USERLI
ST"
);
f
i.
read(
(char*
)&l
i
st,
si
zeof
(l
ist
));
fi
.cl
ose(
);
f
or(
i=0;
i
<li
st.
no;
i
++)
{
cout
<<"
\n"
<<i
+1<<"
."<<l
i
st.
user
s[i
];

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

}
show2(
);
get
ch(
);
}
v
oidnamecut
ter
(charname[
])
{
user
li
stu;
chart
emp[
50]
;
inti
;
i
fst
ream f
i(
"USERLI
ST"
);
fi
.r
ead(
(char*
)
&u,
si
zeof
(u)
);
fi
.cl
ose(
);
f
or(
i=0;
i
<u.
no-
1;i
++)
{
i
f(
str
cmp(
u.user
s[i
],
name)
==0)
{
st
rcpy
(temp,
u.user
s[i
])
;
st
rcpy
(u.
user
s[i
],
u.user
s[i
+1]
);
st
rcpy
(u.
user
s[i
+1]
,
temp)
;
}
}
u.
no-
-;
ofst
ream f
o("
USERLI
ST"
);
f
o.wr
it
e((
char*
)&u,
si
zeof
(u)
);
fo.
close(
);
}

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

REQUI
REMENTS
HARDWAREREQUI
RED

Pri
nter,topri
nttherequi
reddocument
sof
theproject
CompactDr ive
Processor:Pentium I
II
Ram :64MB
Harddisk:20Gb.

SOFTWAREREQUI
RED

Oper
ati
ngsyst
em : Wi
ndowsXP
Tur
boC++,forexecut
ionofpr
ogram and
Msword,f
orpresenat
ti
onofoutput
.
www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

BI
BLI
OGRAPHY

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com
Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

COMPUTERSCI
ENCEI
NC++BY:
–SUMI
TAARORA
www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

www.
cbsepor
tal
.com

Downl
oadedFr
om:
htt
p:/
/www.
cbsepor
tal
.com

Вам также может понравиться