You are on page 1of 31

Downloaded From: http://www.cbseportal.

com

COMPUTER SCIENCE PROJECT FILE ON BOOK-SHOP

PROJECT PREPARED BY:


Ashish Kumar XII Session: 2009 20!0 "win# $hristian %ublic Senior Secondar& School

Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

TABLE OF CONTENTS
$erti'icate Ac(nowled#ement )eader 'iles and their purpose $odin# *imitations +e,uirements -iblio#raph&
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

Ac(nowled#ement
I than( m& $omputer Science teacher .iss. +upali /aiswal 'or #uidance and support. I also than( m& %rincipal .rs. S. $hand. I would also li(e to than( m& parents and m& sister 'or encoura#in# me durin# the course o' this pro0ect. Finall& I would li(e to than( $-S" 'or #i1in# me this opportunit& to underta(e this pro0ect.

Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

$erti'icate
2his is to certi'& that Ashish Kumar o' class twel1e3 "win# $hristian public Senior Secondar& School3 Allahabad has success'ull& completed his pro0ect in computer practicals 'or the AISS$" as prescribed b& $-S" in the &ear 2004 2009.

Date : +e#istration 5o. :


Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

Si#nature o' Internal "6aminer


777777777777777777

Si#nature o' "6ternal "6aminer


777777777777777777

HEADER FILES USED AND THEIR PURPOSE


1. FSTREAM.H for file handling, cin and cout 2. PROCESS.H for exit() function 3. CONIO.H for clrscr() and getch() functions 4. STDIO.H for standard I/O operations
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

5. STRING.H for string handling . CTYPE.H for character handling

Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

!O"I#$

#include<fstream.h> #include<conio.h> #include<string.h>


Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

#include<process.h> #include<stdio.h> #include<ctype.h> class subject { public: char s[5][4 ]!sub[5][5][4 ]" subject#$ { strcpy#sub[ ][ ]!%&hysics '()*+,-%$" strcpy#sub[ ][.]!%&hysics '()*+,--%$" strcpy#sub[ ][/]!%&radeep &hysics%$" strcpy#sub[ ][0]!%1.(.2erma3t%$" strcpy#sub[ ][4]!%+ogether 4ith%$" strcpy#sub[.][ ]!%(hemistry '()*+,-%$" strcpy#sub[.][.]!%(hemistry '()*+,--%$" strcpy#sub[.][/]!%&radeep (hemistry%$" strcpy#sub[.][0]!%+ogether 4ith%$" strcpy#sub[.][4]!%&.5ahaadur3t%$" strcpy#sub[/][ ]!%6aths '()*+,-%$" strcpy#sub[/][.]!%6aths '()*+,--%$" strcpy#sub[/][/]!%6aths '7,-3t%$" strcpy#sub[/][0]!%6aths '7,--%$" strcpy#sub[/][4]!%*.7.8harma3t%$" strcpy#sub[0][ ]!%9lemingo +e:tboo;%$"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

strcpy#sub[0][.]!%2istas +e:tboo;%$" strcpy#sub[0][/]!%9lemingo '7%$" strcpy#sub[0][0]!%2istas '73t%$" strcpy#sub[0][4]!%<olden <uide%$" strcpy#sub[4][ ]!%8umita =rora%$" strcpy#sub[4][.]!%+ogether 4ith%$" strcpy#sub[4][/]!%)>ergreen (??%$" strcpy#sub[4][0]!%*ohit@uestion5an;%$" strcpy#sub[4][4]!%Asborne3t%$" strcpy#s[ ]!%&hysics3t%$" strcpy#s[.]!%(hemistry3t%$" strcpy#s[/]!%6aths3t%$" strcpy#s[0]!%)nglish3t%$" strcpy#s[4]!%(omputer 8cience%$" B B" >oid shoC#$" >oid shoC/#$" class userlist { public: int no" char users[. B"
Downloaded From: http://www.cbseportal.com

][5 ]"

Downloaded From: http://www.cbseportal.com

class user { public: int sbj[5][D]!totp!totr" char passCord[/ ]" >oid shoCpb#$ { cout<<%3n3n3n3n3n3n E&E &urchase3n E5E 5ac;%" B B" >oid uppercase#char F$" >oid purGret#char name[]$" >oid notification#user H$" >oid setdefault#user H$" >oid ch;usrlst#$" >oid ch;boo;lst#$" >oid shoCuserlist#$" int crtusr#$" int shoCboo;s#$" int openacc#$" >oid namecutter#char name[]$" int main#$ { te:tbac;ground#0$" te:tcolor# $"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

ch;usrlst#$" ch;boo;lst#$" mpage: clrscr#$" char ch" cout<<%3n3n3t3t3t4elcome +o =81-81 5AAI81A&3n3n3n3n3n E.E 8ee the %" cout<<%lists of boo;s3n E/E (reate an account3n E0E Apen an account%" cout<<%3n E4E 8ee about no. of boo;s purchasedJreturned3n%" cout<<% E5E 8ee the list of accounts3n EKE @uit%"shoC#$" chLgetch#$" sCitch#ch$ { case E.E: if#shoCboo;s#$LL.$ { goto mpage" B brea;" case E/E: crtusr#$" goto mpage" case E0E: openacc#$" goto mpage" case E4E: purGret#%5AAIM-8+%$" goto mpage" case E5E: shoCuserlist#$"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

goto mpage" case EKE: return " default : goto mpage" B getch#$" return " B int crtusr#$ { clrscr#$" char name[5 ]!reply" ifstream fi" user u"userlist list" fi.open#%N8)*M-8+%$"fi.read##char F$ Hlist!siOeof#list$$"fi.close#$" if#list.noLLPP$ { clrscr#$"cout<<%3n3tQou canEt create any account.3n3t%" cout<<%8ince the accoutn list is full!3n3tso you ha>e to%" cout<<% delete an account%"shoC/#$"getch#$"return " B cout<<%3n )nter your name#ma: 4P characters$:3n %" page/: cin.getline#name!4P$"uppercase#name$" if#name[ ]LLE3 ERRname[ ]LLE E$ {
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

clrscr#$" cout<<%3n &lease enter a >alid name:%"goto page/" B for#int iL "name[i]SLE3 E"i??$ { if#name[i]LLE33ERRname[i]LLEJERRname[i]LLE:ERRname[i]LLEFERR name[i]LLETERRname[i]LLE3%ERRname[i]LLE<ERRname[i]LLE>ERR name[i]LLERE$ { clrscr#$" cout<<%3n &lease enter a >alid name:%"goto page/" B B fi.open#name$" if#fi.good#$$ { clrscr#$" cout<<%3n +he name you ha>e entered is already presentS%" cout<<%3n &lease enter another:3n %"goto page/" B fi.close#$" page: clrscr#$" cout<<%3n 7o you Cant to add a passCordT #yJn$:%"replyLgetch#$" if#replyLLEQERRreplyLLEyE$ { clrscr#$"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

cout<<%3n )nter your passCord#ma: .P characters$:3n %" cin.getline#u.passCord!.P$" B else if#replyLLE'ERRreplyLLEnE$ { strcpy#u.passCord!%########%$" B else{ goto page"B setdefault#u$" ofstream fo#name$" fo.Crite##char F$ Hu!siOeof#u$$"fo.close#$" strcpy#list.users[list.no]!name$"list.no??" fo.open#%N8)*M-8+%$"fo.Crite##char F$ Hlist!siOeof#list$$"fo.close#$" clrscr#$"cout<<%3n3n3t(ongratulationsS %" cout<<%Qou ha>e created your account of name:3n3tE%<<name<<%E%" shoC/#$"getch#$" return " B >oid setdefault#user Husr$ { int i!j" for#iL "i<5"i??$ { for#jL "j<D"j??$
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

{ usr.sbj[i][j]L " B B usr.totpL "usr.totrL " B >oid ch;usrlst#$ { ifstream usrlst" usrlst.open#%userlist%$" if#Susrlst.good#$$ { ofstream fo#%userlist%$" userlist list" list.noL " fo.Crite##char F$ Hlist!siOeof#list$$" fo.close#$" B usrlst.close#$" B >oid ch;boo;lst#$ { ifstream boo;lst"int i!j" boo;lst.open#%boo;list%$" if#Sboo;lst.good#$$
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

{ ofstream fo#%boo;list%$" user b;lst" for#iL "i<5"i??$ { for#jL "j<5"j??$ { b;lst.sbj[i][j]L. B B for#iL "i<5"i??$ { b;lst.sbj[i][5]L "b;lst.sbj[i][K]L " B b;lst.totpL "b;lst.totrL " fo.Crite##char F$Hb;lst!siOeof#b;lst$$" fo.close#$" B boo;lst.close#$" B int shoCboo;s#$ { user guest"subject sb"char i!;!ch!ch.!ch/"int :!y!j" page.: clrscr#$" ifstream fi#%5oo;list%$"
Downloaded From: http://www.cbseportal.com

"

Downloaded From: http://www.cbseportal.com

fi.read##char F$ Hguest!siOeof#guest$$" fi.close#$"cout<<%3n3n3n3n3n3n3n%" for#:L ":<5":??$ { cout<<% E%<<:?.<<%E %<<sb.s[:]<<%3n%" B cout<<% E5E 5ac;%" shoC#$"chLgetch#$" for#iLE.E!:L "i<LE5E"i??!:??$ { page/: clrscr#$" if#chLLi$ { cout<<%3n3n3n3t3t%<<sb.s[:]<<%3n3n3n3n%" for#jL "j<5"j??$ { cout<<% 3E%<<j?.<<%3E %<<sb.sub[:][j]<<%3t%" cout<<guest.sbj[:][j]<<% remaining3n%" B cout<<% E5E 5ac;%"shoC#$"ch.Lgetch#$" for#;LE.E!yL ";<LE5E";??!y??$ { if#ch.LL;$ { page0: clrscr#$"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

cout<<%3n3t3t3t3t%<<sb.sub[:][y]" guest.shoCpb#$"shoC#$"ch/Lgetch#$" if#ch/LLE&ERRch/LLEpE$ { if#guest.sbj[:][y]> $ { guest.totp??"guest.sbj[:][5]??"guest.sbj[:][y],," notification#guest$" B else { clrscr#$" cout<<%3n3n3tQou canEt purchase this boo;.3n3t6a;e %" cout<<%sure that no. of copies of this boo;3n3tin %" cout<<%this shop is greater than Oero.%" shoC/#$"getch#$"goto page/" B B else if#ch/LLE5ERRch/LLEbE${ goto page/"B else{ goto page0"B brea;" B B if#ch.LLE5ERRch.LLEbE${ goto page."B else{ goto page/"B B
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

B if#chLLE5ERRchLLEbE${ return ."B else{ goto page."B B >oid notification#user Hu$ { clrscr#$" ofstream f#%5AAIM-8+%$" f.Crite##char F$ Hu!siOeof#u$$" f.close#$" cout<<%3n3n3n3n3n3n3n3t+han; you for your purchasing this boo;. %" cout<<%'e:t time you must create3n3tan account so that you can %" cout<<%purchase more than one boo; and also can3n3treturn boo;s%" cout<<% purchased from this shop.3n3n3n3n3n%" cout<<%3t'oC press any ;ey to e:it%" getch#$" e:it# $" B >oid shoC#$ { cout<<%3n3n3n3n3n3t&ress any of the ;eys gi>en abo>eS%" B
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

>oid shoC/#$ { cout<<%3n3n3n3n3n3t&ress any ;ey to bac;S%" B >oid purGret#char name[]$ { clrscr#$" user u"subject s"ifstream fi#name$"int i" fi.read##char F$ Hu!siOeof#u$$"fi.close#$" cout<<%3n3n3n3n 8ubject3t3t&urchased3t*eturned3n3n3n%" for#iL "i<5"i??$ { cout<<% %<<i?.<<%.%<<% %<<s.s[i]<<%3t%<<u.sbj[i][5]" cout<<%3t3t%<<u.sbj[i][K]<<%3n%" B cout<<% K. %<<%+otal3t3t%<<u.totp<<%3t3t%<<u.totr"shoC/#$"getch#$" B int openacc#$ { user u!b;lst"userlist list" char name[5 ]!passC[/ ]!reply"ofstream fo" page.:clrscr#$" cout<<%3n )nter your account name:3n %"cin.getline#name!4P$" uppercase#name$"ifstream fi#name$"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

if#Sfi.good#$$ { pagename: clrscr#$"cout<<%3n3n 4rong account nameS3n )nter againT#yJn$3n %" replyLgetch#$" if#replyLLEyERRreplyLLEQE${ goto page."B else if#replyLLEnERRreplyLLE'E${ return "B else{ goto pagename"B B fi.read##char F$ Hu!siOeof#u$$"fi.close#$" fi.open#%N8)*M-8+%$"fi.read##char F$ Hlist!siOeof#list$$"fi.close#$" int flagL " for#int sL "s<list.no"s??$ { if#Sstrcmp#name!list.users[s]$${ flagL."brea;"B B if#flagLL $ { strcpy#list.users[list.no]!name$"list.no??" fo.open#%N8)*M-8+%$" fo.Crite##char F$ Hlist!siOeof#list$$"fo.close#$" B if#Sstrcmp#u.passCord!%########%$${ goto page0"B page/: clrscr#$"cout<<%3n )nter your passCord:3n %" cin.getline#passC!.P$"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

if#strcmp#u.passCord!passC$$ { pagepass: clrscr#$"cout<<%3n3n 4rong passCordS3n )nter againT#yJn$3n %" replyLgetch#$" if#replyLLEyERRreplyLLEQE${ goto page/"B else if#replyLLEnERRreplyLLE'E${ return "B else{ goto pagepass"B B page0: clrscr#$"fi.open#%5AAIM-8+%$" fi.read##char F$ Hb;lst!siOeof#b;lst$$"fi.close#$" cout<<%3n3n3n3t4elcome %<<name" cout<<%3n3n3n3n E.E &urchaseJreturn boo;s3n E/E 'o. of boo;s%" cout<<% you are ha>ing3n E0E 'o. of boo;s purchasedJretutned %" cout<<%by you3n E4E =ddJmodify passCord3n E5E *emo>e passCord3n %" cout<<%EKE 7elete your account3n E5E 5ac;%"shoC#$"replyLgetch#$" if#replyLLE.E$ { subject sb"char i!;!ch!ch.!ch/"int :!y!j" page0.: clrscr#$" cout<<%3n3n3n3n3n3n3n%" for#:L ":<5":??$ { cout<<% E%<<:?.<<%E %<<sb.s[:]<<%3n%"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

B cout<<% E5E 5ac;%" shoC#$"chLgetch#$" for#iLE.E!:L "i<LE5E"i??!:??$ { page0/: clrscr#$" if#chLLi$ { cout<<%3n3n3n3t3t%<<sb.s[:]<<%3n3n3n3n%" for#jL "j<5"j??$ { cout<<% 3E%<<j?.<<%3E %<<sb.sub[:][j]<<%3t%" cout<<b;lst.sbj[:][j]<<% remaining3n%" B cout<<% E5E 5ac;%"shoC#$"ch.Lgetch#$" for#;LE.E!yL ";<LE5E";??!y??$ { if#ch.LL;$ { page00: clrscr#$" cout<<%3n3t3t3t3t%<<sb.sub[:][y]" u.shoCpb#$"cout<<%3n E*E *eturn%"shoC#$"ch/Lgetch#$" if#ch/LLE&ERRch/LLEpE$ { if#b;lst.sbj[:][y]> $
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

{ u.totp??"b;lst.totp??"u.sbj[:][5]??"b;lst.sbj[:][5]??" u.sbj[:][y]??"b;lst.sbj[:][y],,"fo.open#%5AAIM-8+%$" fo.Crite##char F$ Hb;lst!siOeof#b;lst$$"fo.close#$" fo.open#name$"fo.Crite##char F$ Hu!siOeof#u$$"fo.close#$" clrscr#$"cout<<%3n3n3tAIS Qou ha>e purchased this boo;%" B else { clrscr#$" cout<<%3n3n3tQou canEt purchase this boo;.3n3t6a;e %" cout<<%sure that no. of copies of this boo;3n3tin %" cout<<%this shop is greater than Oero.%" B shoC/#$"getch#$" goto page0/" B else if#ch/LLErERRch/LLE*E$ { if#u.sbj[:][y]> $ { u.totr??"b;lst.totr??"u.sbj[:][K]??"b;lst.sbj[:][K]??" u.sbj[:][y],,"b;lst.sbj[:][y]??"fo.open#%5AAIM-8+%$" fo.Crite##char F$ Hb;lst!siOeof#b;lst$$"fo.close#$" fo.open#name$"fo.Crite##char F$ Hu!siOeof#u$$"fo.close#$"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

clrscr#$"cout<<%3n3n3tAIS Qou ha>e returned this boo;%" B else { clrscr#$" cout<<%3n3n3tQou canEt return this boo;.3n3t6a;e %" cout<<%sure that no. of copies of this boo;3n3tyou%" cout<<% are ha>ing is greater than Oero.%" B shoC/#$"getch#$" goto page0/" B else if#ch/LLE5ERRch/LLEbE${ goto page0/"B else{ goto page00"B B B if#ch.LLE5ERRch.LLEbE${ goto page0."B else{ goto page0/"B B B if#chLLE5ERRchLLEbE${ goto page0"B else{ goto page0."B B else if#replyLLE/E$ {
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

clrscr#$" int i!j" for#iL "i<5"i??$ { subject sb" cout<<%3n %<<sb.s[i]<<%3n%" for#jL "j<5"j??$ { cout<<% %<<j?.<<%. %<<sb.sub[i][j]<<%3t%<<u.sbj[i][j]" cout<<% remaining3n%" B B shoC/#$"getch#$"goto page0" B else if#replyLLE0E$ { purGret#name$" goto page0" B else if#replyLLE4E$ { clrscr#$"cout<<%3n )nter neC passCord#ma: .P characters$:3n %" cin.getline#passC!.P$"strcpy#u.passCord!passC$"clrscr#$" cout<<%3n3t&assCord modified succesfullyS%"shoC/#$"getch#$" fo.open#name$"fo.Crite##char F$ Hu!siOeof#u$$"fo.close#$" goto page0"
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

B else if#replyLLE5E$ { page05: clrscr#$"cout<<%3n *emo>e passCordT #yJn$:%"replyLgetch#$" if#replyLLEQERRreplyLLEyE$ { strcpy#u.passCord!%########%$"fo.open#name$" fo.Crite##char F$ Hu!siOeof#u$$"fo.close#$"clrscr#$" cout<<%3n3t&assCord remo>ed successfullyS%" shoC/#$"getch#$"goto page0" B else if#replyLLE'ERRreplyLLEnE${ goto page0"B else{ goto page05"B B else if#replyLLEKE$ { page0K: clrscr#$" cout<<%3n 7o you Cant to delete your accountT #yJn$:%"replyLgetch#$" if#replyLLEQERRreplyLLEyE$ { clrscr#$"remo>e#name$" cout<<%3n3tQour account is deleted successfullyS%"shoC/#$"getch#$" namecutter#name$" return " B else if#replyLLE'ERRreplyLLEnE${ goto page0"B
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

else{goto page0K"B B else if#replyLLEbERRreplyLLE5E$ { page0b: clrscr#$" cout<<%3n 7o you Cant to e:it from your accountT#yJn$:%" replyLgetch#$" if#replyLLEQERRreplyLLEyE${ return "B else if#replyLLE'ERRreplyLLEnE${ goto page0"B else{ goto page0b"B B else{ goto page0"B B >oid uppercase#char Fa$ { for#int iL "a[i]SLE3 E"i??$ { a[i]Ltoupper#a[i]$" B B >oid shoCuserlist#$ { clrscr#$"int i"userlist list"ifstream fi#%N8)*M-8+%$" fi.read##char F$ Hlist!siOeof#list$$"fi.close#$" for#iL "i<list.no"i??$ {
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

cout<<%3n %<<i?.<<%. %<<list.users[i]" B shoC/#$"getch#$" B >oid namecutter#char name[]$ { userlist u"char temp[5 ]"int i" ifstream fi#%N8)*M-8+%$"fi.read##char F$ Hu!siOeof#u$$"fi.close#$" for#iL "i<u.no,."i??$ { if#strcmp#u.users[i]!name$LL $ { strcpy#temp!u.users[i]$" strcpy#u.users[i]!u.users[i?.]$" strcpy#u.users[i?.]!temp$" B B u.no,,"ofstream fo#%N8)*M-8+%$" fo.Crite##char F$ Hu!siOeof#u$$"fo.close#$" B

Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

REQUIREMENTS
)A+D8A+" +"9:I+"D %rinter3 to print the re,uired documents o' the pro0ect $ompact Dri1e %rocessor : %entium III +am : ;< . )arddis( : 20 =b. S>F28A+" +"9:I+"D >peratin# s&stem : 8indows X% 2urbo $??3 'or e6ecution o' pro#ram and .s word3 'or presenattion o' output.
www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!&

BIBLIOGRAPHY
Downloaded From: http://www.cbseportal.com

Downloaded From: http://www.cbseportal.com

COMPUTER SCIENCE IN C'' BY :( SUMITA ARORA


www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!& www.cbse !"#$%.c!&

Downloaded From: http://www.cbseportal.com

You might also like