Date post: | 18-Feb-2018 |
Category: |
Documents |
Upload: | divyashishtomar |
View: | 218 times |
Download: | 0 times |
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 1/52
JAWAHAR NAVODAYA
VIDYALAYA SA,UMATHEL,THOUBAL
2012-2013
INVESTIGATORY PROJECT
OF
COMPUTER SCIENCE
Pre!re" #$%
H&''!$ Le()!*3+332.
A// Le()!*3+32.45!r& D!r6ee*3+33+. !/"
Pe5 D5! B)47&!*3+3.
1
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 2/52
CONTENTS• CERTIFICATE 3
• ACKNOWLEDGEMENT 4
• INTRODUCTION 5
• OBJECTIVE 6
• ANALYSIS REPORT 7
• CLASS DESCRIPTION 8
• COADING 9
• SREEN SHOT 46
• FRONT PAGE 47
• MENU PAGE 47
•
SUBMENU PAGE 48
• ADD !UESTION 48
• AFTER !UESTION IS ADDED 49
2
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 3/52
ERTIFI ATE
T)&' &' )ere#$ 7 (er7&8$ 7)!7 7)e r6e(7
e/7&79e" :O/9&/e ;4&< =)&() "e!9' =&7)
/9&/e >4& 8r '()9 !/" (99e?e' ?er',
=)ere ! 4'er (!/ ?&@e /9&/e 7e'7 8r
"&88ere/7 '4#6e(7'T)&' r6e(7 &' #e&/?
'4#5&77e" #$%
H&''!$ Le()!*3+332.
A// Le()! *3+32.
45!r& D!r6ee*3+33+.
Pe5 D5! B)47&!*3+3.
3
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 4/52
A KNOWLEDGEMENT
I" #$%&' () $%* %"+$," -&).,%*) "$
)/-*),, +0 ,12)*) ".2, "$ $%*
$+-%")* ").)* 12 -*$1'12 .
)&-12 .2' 12 "1, -*$)" H1,
.&%.(&) %1'.2): ,%--$*" .2'
,%-)*1,1$2 ;$* .&& "*$% "1, -*$)"
.*) *),-$2,1(&) ;$* $+-&)"1$2 $; "1,
-*$)"
4
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 5/52
5
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 6/52
I/7r"4(7&/%
T)e /9&/e >4& &' #!'&(!99$ 8r 7)e '()9 !/" (99e?e ?er', =)ere !
4'er (!/ ?&@e !/ /9&/e 7e'7 8r ! '4#6e(7 *'.A((r"&/? 7 7)e/45#er 8 5!r' )&')er e@!94!7&/ )!' 7 #e "/e W)ere 7)e
'74"e/7 !7 9!r?e , 7)&' /9&/e ;4& '(r47&/&e 7)e 4/&@er'&7$&/'7&747&/
r#9e5' !7 /(e !/" r"4(e ! >4&( re'/'e &/ ! 9&5&7e" 7&5e
I7 (!/ #e 84r7)er e7e/"e" 7 !/$ r?!/&!7&/ r (5!/$
=) =!/7 7 (/"4(7 7)e e!5&/!7&/ 4'&/? /9&/e
T)e r6e(7 ee' 84r "&88ere/7 "!7! 8&9e' '4() !' %
• C547er"!7
• M!7)"!7• S(&e/(e"!7
• Ge/er!9"!7
O/9&/e >4& (!/ #e @&e=e" 8r5 7= !'e(7' T)e e!5&/er'
er'e(7&@e !/" 7)e (!/"&"!7e' er'e(7&@eO/9&/e ?&@e' $4 7 !""
4'er #e/e8&7'Y4 (!/
• Me!'4re' $4r '&99
• P45 4 $4r re'45e
• Cer7&8$ $4r !#&9&7$
• Pr@e $4r #r&99&!/(e
O/9&/e >4& r@&"e' !475!7e" !/" 'e5&-!475!7e" '4r7 8r
?e/er!7&/ 8 >4e'7&/ !er 4'e" &/ /9&/e e!5&/!7&/O/9&/e
>4& (5#&/e' @!r&4' 8&e9" ,7!#9e' 8r5 "!7!#!'e !/" 7&/
'e9e(7e" #$ 4'er =) (!/ #e e!5&/er r 7)e (!/"&"!7e 7 (re!7e
8&/!9 >4e'7&/ !er !((r"&/? 7 )&' re>4&re5e/7
6
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 7/52
OBJECTIVE%
NEED OF ONLINE QUIZ
From the last few decades it has alwas !ee" a headache for
e#ami"er to fi"ed o$t a"swer to followi"% &$estio"'
• (h does it ta)e too lo"% for declari"% res$lts *
• +ow to red$ce e#tra cost i"c$rred d$ri"% e#ami"atio"*
• +ow to a,oid totali"% a"d chec)i"% errors !efore dis-lai"% the
fi"al res$lt*
• +ow to write st$de"t i" co"ti"$o$s ma""ers *
I" res-o"se to these -ro!lems .software e"%i"eeri"% -ractices are
!ei"% ado-ted i" the ed$catio"al sector/ 0he real sol$tio" he"ce were
fo$"d i" o"li"e e#ami"atio"s/0h$s.ha,i"% clearl $"derstood that
what of the -ro!lem. o"li"e &$i is a ste- towards a sol$tio"/
O"li"e &$i is !ased o" the -hiloso-h that as i" other
a--licatio" areas more a"d more wor) i" sstem de,elo-me"t is also
!ei"% tra"sferred to the com-$ter itself. while h$ma" !ei"% retai"
o"l the co"trol eleme"t/ome of the feat$res of o"li"e &$is are
• ra-hical $ser i"terface
• Q$estio" !a") mai"te"a"ce
• es$lt mai"te"a"ce
• Doc$me"tatio" s$--orts
7D87N07E OF ONLINE QUIZ
O"li"e &$i also -ro,ide a" e#te"si,e res$lt e,al$atio"s sstem for
st$de"ts. who are st$di"% at i"stit$te or colle%e or school.!e a!le to
a"swer at a" mome"t for this de%ree9credit /0he followi"%
ad,a"ta%e ca" !e o!tai" ! $si"% o"li"e &$i
• I"te%ratio" of acti,ities of co"d$cti"% e#ami"atio"
• 7$tomatic sta"dardiatio" of the e#ami"atio" -roced$re
• :rod$ce a hi%h &$alit -erforma"ce for the or%a"iatio"
• $ara"teed of errors i" e,al$atio" -rocess
• ;etter data sec$rit i" testi"% -a)a%e
• a"dom &$er sstem for i"di,id$al
<
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 8/52
=
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 9/52
ANALYSIS REPORT%
0he -ro>ect )ee-s fo$r differe"t data files s$ch as'
• ?om-$ter/dat
• @aths/dat• cie"ce/data
• e"eral/dat
7ll a!o,e files ha,e the commo" fields. !$t the records are a--e"ded
accordi"% to the e#ami"atio" o-tio"/
Q$esA"o' &$estio" "$m!er
Q$es ' "ame of the &$estio"
7"s1 ' first a"swer of the &$estio"
7"s2 ' seco"d a"swer of the &$estio"
7"s3 ' third a"swer of the &$estio"0he o"li"e &$i sstem dis-la the res$lt immediatel after a &$i is
com-leted/0he o"li"e &$i sstem )ee-s trac) of the followi"% o-tio" for
mai"tai"i"% its data!ase a"d &$i/
QUIZ
O:0ION
:L7B
7DDQUE0ION
EDI0
QUI0
PLAY'T1, $-"1$2 $-)2, . ,%(+)2% .,<U;A@ENU
?O@:U0E
@70+E@70I?
?IEN?E
ENE7L
E0UN
C$-arrow dow"arrow@o,eEN0EGselectE?GE#it
From the a!o,e me"$s whe" o$ select a" o-tio".o$ will !e as)ed to
e"ter o$r "ame/7fter e"teri"% o$r "ame .it will dis-la the &$estio" o"eH !Ho"e a"d o$ ha,e to %i,e the a"swer i" s-ecified time limit/If the time
limit is o,er. it will dis-la the "e#t &$estio" a"d ero will !e added to o$r
score.otherwise.o$r score will !e i"creme"t ! o"e/I" the e"d.o$ will see
!oard of the &$i/imilarl.o$ ca" atte"d all the s$!Hme"$ o-tio"s.re&$ired
! o$/
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 10/52
ADD ;UESTION%I" this o-tio". o$ ca" add differe"t &$estio"
to o$r -re,io$s s$!Hme"$ o-tio"s/For e#am-le.o$ select
?O@:U0E.o$ will see a scree" for addi"% a &$estio" with
its &$estio" "$m!er a"d &$estio" detail/+ere. the &$estio" "$m!er %e"erate a$tomaticall/7fter
e"teri"% a"swers three a"swers a"d its ri%ht sol$tio". o$ will
!e as)ed for $-dati"% the data!ase for "e#t &$i/
EDIT%I" this o-tio". o$ ca" delete. modif o$r -re,io$sl
e"tered &$estio"s as re&$ired/+ere. all the -rocess will tra"sact
thro$%h the &$estio" "$m!er/
CLASS DESCRIPTION%0here are three differe"t class !ei"% $sed/0hese are
• Li"es/It co"trols f$"ctio" related to draw a"d ,ertical li"e
a"d !o#es/
• @e"$/It co"trols the o,erall Q$i -ro>ect/It dis-las all
me"$s a"d s$!Hme"$s/
• Q$i/It co"trols o,erall f$"ctio" related to &$i. li)eaddi"%.deleti"% or modifi"% &$estio"s i" the data!ase/
1J
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 11/52
CODINGPROJE T OMPUTER QUIZ
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 IN LUDED HEADER FILES
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
i"cl$de iostream/hG
i"cl$de co"io/hGi"cl$de dos/hG
i"cl$de stri"%/hG
i"cl$de fstream/hGi"cl$de -rocess/hG
i"cl$de stdli!/hG
i"cl$de stdio/hGi"cl$de ct-e/hG
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 CLASS NAME ' 9&/e'
99 DETAILS ' IT CONTROLS FUNCTIONS RELATED TO DRAW
== LINES: BO>ES: ETC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
class 9&/e'
M
-$!lic '
,oid li"eAhor Ci"t. i"t. i"t. char ,oid li"eA,er Ci"t. i"t. i"t. char
,oid !o# Ci"t.i"t.i"t.i"t.char
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
11
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 12/52
99 CLASS NAME ' 5e/4
99 DETAILS ' IT CONTROLS OVER ALL FUNCTIONING OF PROJECT
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
class me"$M
-$!lic '
,oid mai"Ame"$C,oid ?har Ks$!Ame"$C,oid
,oid startC,oid
-ri,ate ',oid editAme"$C,oid
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK99 CLASS NAME ' &$i
99 DETAILS ' IT CONTROLS OVER ALL THE FUNCTIONS
== RELATED TO !UI?
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
class &$i
M
:$!lic',oid -laCchar file"ameP13
,oid addCchar file"ameP13
,oid deletio"Cchar file"ameP13 ,oid modifCchar file"ameP13
-ri,ate '
,oid deleteArecordCchar file"ameP13. i"t
,oid modifArecordCchar file"ameP13. i"t ,oid dis-laAscoreCchar "ameP2J. i"t. i"t
i"t record"oCchar file"ameP13. i"t
i"t recordAco$"tCchar file"ameP13 i"t fo$"dArecordCchar file"ameP13. i"t
,oid dis-laArecordCchar file"ameP13. i"t
i"t &$esA"o
char &$esP6J char a"s1P5J
char a"s2P5J
char a"s3P5J char sol
12
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 13/52
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' li"es
99 FUN?0ION N7@E ' li"eAhor 99 DE07IL ' I0 7??E:0 0+E O( 7ND ?OLU@N 7ND
99 D7( 0+E +OIZON07L LINE
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid li"es '' li"eAhorCi"t col$m"1. i"t col$m"2. i"t row. char c
M for C col$m"1 col$m"1col$m"2 col$m"1RR
M
%oto#Ccol$m"1.row
co$t c
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' li"es99 FUN?0ION N7@E ' li"eA,er
99 DE07IL ' I0 7??E:0 0+E O( 7ND ?OLU@N 7ND
99 D7( 0+E 8E0I?7L LINE99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid li"es '' li"eA,erCi"t row1. i"t row2. i"t col$m". char c
M for C row1 row1row2 row1RR
M
%oto#Ccol$m".row1 co$t c
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' li"es
99 FUN?0ION N7@E ' !o#99 DE07IL ' I0 7??E:0 0+E O( 7ND ?OLU@N 7ND
99 D7( 0+E ;OS
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid li"es '' !o#Ci"t col$m"1. i"t row1. i"t col$m"2. i"t row2. char c
M char ch21=
char c1. c2. c3. c4
char l116. l21<
if Cc ch
13
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 14/52
M
c1 21=
c2 11 c3 12
c4 21<
l1 16 l2 1<
else M
c1 c
c2 c
c3 c c4 c
l1 c
l2 c
%oto#Ccol$m"1.row1
co$t c1 %oto#Ccol$m"2.row1
co$t c2
%oto#Ccol$m"1.row2 co$t c3
%oto#Ccol$m"2.row2
co$t c4
col$m"1RR col$m"2HH
li"eAhorCcol$m"1.col$m"2.row1.l1
li"eAhorCcol$m"1.col$m"2.row2.l1 col$m"1HH
col$m"2RR
row1RR row2HH
li"eA,erCrow1.row2.col$m"1.l2
li"eA,erCrow1.row2.col$m"2.l2
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK99 ?L7 N7@E ' me"$
99 FUN?0ION N7@E ' start
99 DE07IL ' I0 ?E70E 0+E O:ENIN ?EEN99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid me"$ '' startC,oid
M
14
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 15/52
li"es li"e
te#tmodeC?4J
clrscrC te#t!ac)%ro$"dCLI+0?B7N
te#tcolorC;L7?T
clrscrC %oto#C=.12
co$t ? O @ : U 0 E
%oto#C25.12 co$t Q U I Z
li"e/!o#C4.1J.36.14.21
%oto#C5.21
co$t@7DE ;B ' %oto#C5.22
co$t7$thor V +er 0eam
li"e/!o#C2.1.4J.24.21
%oto#C4.1J %etchC
te#t!ac)%ro$"dC;L7?T
te#tcolorCLI+07B clrscrC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' me"$
99 FUN?0ION N7@E ' mai"Ame"$99 DE07IL ' I0 ?E70E 0+E @7IN @ENU 0O ?ON0OL
99 7LL 0+E FUN?0ION
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid me"$ '' mai"Ame"$C,oid
M
li"es li"e te#tmodeC?4J
clrscr
i"t ,alid i"t " 4
i"t # 14
char ch1. ch2 char chr121. chr1<5
do
M
li"e/!o# C1.1.3.25.21
15
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 16/52
li"e/li"eAhorC.31.6.16
li"e/!o# C=.3.32.2J.21=
char c124. c225 %oto#C3.24
co$t c1
co$t c2 co$t @o,e EN0EGelect E?GE#it
%oto#C13.5
co$t chr1 te#t!ac)%ro$"dC(+I0E
te#tcolorC;L7?T
%oto#C14.5
c-ri"tfCQ U I Z te#t!ac)%ro$"dC;L7?T
te#tcolorCLI+07B
%oto#C14.=
co$t O:0ION %oto#C14.
co$t HHHHHHH %oto#C14.11
co$t :L7B
%oto#C14.12 co$t 7DD QUE0ION
%oto#C14.13
co$t EDI0
%oto#C14.14 co$t QUI0
%oto#C1J.#
co$t chr %oto#C13.5
do
M do
M
do
Mch1 %etchC
if C ch1 2<
M te#tmodeC?=J
clrscrC
e#itCJ
while CC ch1 W J VV C ch1 W 13
if C ch1 W 13
M
16
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 17/52
do
M
ch2 %etchC if C ch2 2<
M
te#tmodeC?=J clrscrC
e#itCJ
while CC ch2 W <2 VV C ch2 W =J VV C ch2 W
13
while CCC ch1 W J XX CC ch2 W <2 VV C ch2 W =J VV CC ch1 W 13 VV C ch2 W 13
if CC ch1 J VV C ch2 =J
M
%oto#C1J.# co$t
if C" 4M
" 1
# # H 3
else
M
" " R 1 # # R 1
%oto#C1J.# co$t chr
%oto#C13.5
so$"dC2JJ delaC3J
"oso$"dC
if CC ch1 J VV C ch2 <2 M
%oto#C1J.#
co$t if C " 1
M
" 4 # # R 3
else
M
1<
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 18/52
" " H 1
# # H 1
%oto#C1J.#
co$t chr
%oto#C13.5 so$"dC2JJ
delaC3J
"oso$"dC
while CC ch1 W 13 VV C ch2 W 13
if C" 1
Mchar file"ameP13
strc-Cfile"ame.s$!Ame"$C
if Cstrcm-Cfile"ame."$ll
M &$i &
&/-laCfile"ame clrscrC
if C" 2
M
char file"ameP13
strc-Cfile"ame.s$!Ame"$C if Cstrcm-Cfile"ame."$ll
M
te#tmodeC?=J clrscrC
&$i &
&/addCfile"ame te#tmodeC?4J
clrscrC
if C" 3
editAme"$C
while C " W 4 te#tmodeC?=J
clrscrC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' me"$
1=
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 19/52
99 FUN?0ION N7@E ' editAme"$
99 DE07IL ' I0 ?E70E 0+E EDI0 @7IN @ENU
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid me"$ '' editAme"$C,oid
M li"es li"e
i"t ,alid
static i"t " 3 static i"t # 1
char ch1. ch2
char chr121. chr1<5
do M
li"e/!o#C1.14.31.2J.21=
%oto#C21.15
co$t chr1 te#t!ac)%ro$"dC(+I0E
te#tcolorC;L7?T %oto#C22.15
c-ri"tfCE D I 0
te#t!ac)%ro$"dC;L7?T te#tcolorCLI+07B
%oto#C23.1<
co$t DELE0E
%oto#C23.1= co$t @ODIFB
%oto#C23.1
co$t E0UN %oto#C2J.#
co$t chr
%oto#C21.15 do
M
do
Mdo
M
ch1 %etchC if C ch1 2<
M
%oto#C1.15 clreolC %oto#C1.1< clreolC
%oto#C1.1= clreolC
%oto#C1.1 clreolC
%oto#C1.2J clreolC
1
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 20/52
%oto#C1.14 clreolC
ret$r"
while CC ch1 W J VV C ch1 W 13
if C ch1 W 13
M do
M
ch2 %etchC if C ch2 2<
M
%oto#C1.15 clreolC
%oto#C1.1< clreolC %oto#C1.1= clreolC
%oto#C1.1 clreolC
%oto#C1.2J clreolC
%oto#C1.14 clreolC ret$r"
while CC ch2 W <2 VV C ch2 W =J VV C ch2 W
13
while CCC ch1 W J XX CC ch2 W <2 VV C ch2 W =J VV CC ch1 W 13
VV C ch2 W 13
if CC ch1 J VV C ch2 =J
M%oto#C2J.#
co$t
if C" 3M
" 1
# # H 2
else
M
" " R 1 # # R 1
%oto#C2J.# co$t chr
%oto#C21.15
so$"dC2JJ delaC3J
"oso$"dC
if CC ch1 J VV C ch2 <2
2J
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 21/52
M
%oto#C2J.#
co$t if C " 1
M
" 3 # # R 2
elseM
" " H 1
# # H 1
%oto#C2J.#
co$t chr
%oto#C21.15
so$"dC2JJ delaC3J
"oso$"dC
while CC ch1 W 13 VV C ch2 W 13
if C" 1M
char file"ameP13
strc-Cfile"ame.s$!Ame"$C
if Cstrcm-Cfile"ame."$llM
te#tmodeC?=J
clrscrC &$i &
&/deletio"Cfile"ame
te#tmodeC?4J clrscrC
ret$r"
clrscrC ret$r"
elseif C" 2
M
char file"ameP13 strc-Cfile"ame.s$!Ame"$C
if Cstrcm-Cfile"ame."$ll
M
te#tmodeC?=J
21
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 22/52
clrscrC
&$i &
&/modifCfile"ame te#tmodeC?4J
clrscrC
ret$r"
clrscrC
ret$r"
while C " W 3
%oto#C1.15 clreolC
%oto#C1.1< clreolC %oto#C1.1= clreolC
%oto#C1.1 clreolC
%oto#C1.2J clreolC
%oto#C1.14 clreolC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' me"$99 FUN?0ION N7@E ' s$!Ame"$
99 DE07IL ' I0 ?E70E 0+E U; @7IN @ENU 7ND
99 E0UN FILE N7@E
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
char Kme"$ '' s$!Ame"$C,oid
M li"es li"e
clrscrC
i"t ,alid static i"t " 1
static i"t # 1J
char ch1. ch2
char chr121. chr1<5 li"e/!o#C1.1.3.25.21
li"e/li"eAhorC2.3=.23.16
char c124. c225 %oto#C3.24
co$t c1
co$t c2 co$t @o,e EN0EGelect E?GE#it
%oto#C13.6
co$t chr1
te#t!ac)%ro$"dC(+I0E
22
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 23/52
te#tcolorC;L7?T
%oto#C14.6
c-ri"tfC U ; H @ E N U te#t!ac)%ro$"dC;L7?T
te#tcolorCLI+07B
li"e/!o#C11.5.31.<.21= %oto#C14.1J
co$t ?O@:U0E
%oto#C14.12 co$t @70+E@70I?
%oto#C14.14
co$t ?IEN?E
%oto#C14.16 co$t ENE7L
%oto#C14.1=
co$t E0UN
%oto#C12.# co$t chr
%oto#C13.6 do
M
doM
do
M
ch1 %etchC if C ch1 2<
M
clrscrC ret$r"C"$ll
while CC ch1 W J VV C ch1 W 13 if C ch1 W 13
M
do
Mch2 %etchC
if C ch2 2<
MclrscrC
ret$r"C"$ll
while CC ch2 W <2 VV C ch2 W =J VV C ch2 W 13
while CCC ch1 W J XX CC ch2 W <2 VV C ch2 W =J VV CC ch1 W 13 VV
C ch2 W 13
23
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 24/52
if CC ch1 J VV C ch2 =J
M
%oto#C12.# co$t
if C" 5
M " 1
# # H =
else
M
" " R 1
# # R 2
%oto#C12.#
co$t chr
%oto#C13.6 so$"dC2JJ
delaC3J "oso$"dC
if CC ch1 J VV C ch2 <2 M
%oto#C12.#
co$t
if C " 1 M
" 5
# # R =
else
M" " H 1
# # H 2
%oto#C12.# co$t chr
%oto#C13.6
so$"dC2JJ delaC3J
"oso$"dC
while CC ch1 W 13 VV C ch2 W 13
clrscrC
if C" 1
ret$r"Ccom-$ter/dat
24
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 25/52
else
if C" 2
ret$r"Cmaths/dat else
if C" 3
ret$r"Cscie"ce/dat else
if C" 4
ret$r"C%e"eral/dat ret$r"C"$ll
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' recordAco$"t
99 DE07IL ' I0 E0UN 0+E NO/ OF E?OD IN 0+E99 I8EN FILE
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
i"t &$i '' recordAco$"tCchar file"ameP13
M fstream file
file/o-e"Cfile"ame. ios''i"
file/see)%CJ.ios''!e%
i"t tJ while Cfile/readCCchar K this. sieofC&$i
tRR
file/closeC ret$r" t
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' add
99 DE07IL ' I0 7DD 0+E E?OD IN 0+E I8EN FILE99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' addCchar file"ameP13M
li"es li"e
i"t ,alid i"t tA&$esA"o
tA&$esA"o recordAco$"tCfile"ame
tA&$esA"oRR
if CtA&$esA"o 1
25
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 26/52
M
&$esA"o tA&$esA"o
strc-C&$es.a!c strc-Ca"s1.H
strc-Ca"s2.H
strc-Ca"s3.H sol YJY
fstream file
file/o-e"Cfile"ame. ios''o$t X ios''a-- file/writeCCchar K this. sieofC&$i
file/closeC
deleteArecordCfile"ame.tA&$esA"o
char ch
do
M
clrscrC li"e/!o#C1.1.<.23.21=
%oto#C3.5 co$t &$estio" tA&$esA"o
%oto#C3.=
co$t &$estio" ' %oto#C3.1J
co$t a"swer 1 '
%oto#C3.12
co$t a"swer 2 ' %oto#C3.14
co$t a"swer 3 '
%oto#C3.16 co$t sol$tio" '
do
Mli"e/!o#C1.1.<.23.21=
,alid 1
%oto#C1.25 clreolC
%oto#C<2.25 co$t JGESI0
%oto#C3.25
co$t EN0E QUE0ION %oto#C14.=
%etsC&$es
str$-rC&$es if C&$esPJ YJY
ret$r"
if Cstrle"C&$es G 15 XX strle"C&$es J
M
26
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 27/52
,alid J
so$"dC5JJ
delaC1JJ "oso$"dC
%oto#C1.25 clreolC
%oto#C1.24 co$t LEN0+ +OULD NO0 ;E ;L7NT O E70E
0+7N 15
%oto#C1.25 co$t :ress a" )e to co"ti"$e///
%etchC
%oto#C1.24 clreolC
%oto#C1.25 clreolC %oto#C14.= clreolC
while C W,alid
doM
li"e/!o#C1.1.<.23.21= ,alid 1
%oto#C1.25 clreolC
%oto#C<2.25 co$t JGESI0
%oto#C3.25
co$t EN0E 7N(E FO 0+E QUE0ION
%oto#C14.1J %etsCa"s1
str$-rCa"s1
if Ca"s1PJ YJYret$r"
if Cstrle"Ca"s1 G 4
M,alid J
so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C1.25 clreolC
%oto#C1.24
co$t LEN0+ +OULD NO0 E70E 0+7N 4 %oto#C1.25
co$t :ress a" )e to co"ti"$e///
%etchC %oto#C1.24 clreolC
%oto#C1.25 clreolC
%oto#C14.1J clreolC
2<
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 28/52
while C W,alid
do
Mli"e/!o#C1.1.<.23.21=
,alid 1
%oto#C1.25 clreolC %oto#C<2.25
co$t JGESI0
%oto#C3.25 co$t EN0E 7N(E FO 0+E QUE0ION
%oto#C14.12
%etsCa"s2
str$-rCa"s2 if Ca"s2PJ YJY
ret$r"
if Cstrle"Ca"s2 G 4
M ,alid J
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C1.25 clreolC %oto#C1.24
co$t LEN0+ +OULD NO0 E70E 0+7N 4
%oto#C1.25
co$t :ress a" )e to co"ti"$e/// %etchC
%oto#C1.24 clreolC
%oto#C1.25 clreolC %oto#C14.12 clreolC
while C W,alid do
M
li"e/!o#C1.1.<.23.21=
,alid 1 %oto#C1.25 clreolC
%oto#C<2.25
co$t JGESI0 %oto#C3.25
co$t EN0E 7N(E FO 0+E QUE0ION
%oto#C14.14 %etsCa"s3
str$-rCa"s3
if Ca"s3PJ YJY
ret$r"
2=
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 29/52
if Cstrle"Ca"s3 G 4
M
,alid J so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C1.25 clreolC
%oto#C1.24
co$t LEN0+ +OULD NO0 E70E 0+7N 4 %oto#C1.25
co$t :ress a" )e to co"ti"$e///
%etchC
%oto#C1.24 clreolC %oto#C1.25 clreolC
%oto#C14.14 clreolC
while C W,alid do
Mli"e/!o#C1.1.<.23.21=
,alid 1
%oto#C1.25 clreolC %oto#C<2.25
co$t JGESI0
%oto#C3.25
co$t EN0E ?OE?0 OLU0ION FO 0+E QUE0ION C19293
%oto#C14.16
sol %etcheC if Csol YJY
ret$r"
if Csol W Y1Y VV sol W Y2Y VV sol W Y3YM
,alid J
so$"dC5JJ
delaC1JJ "oso$"dC
%oto#C14.16 clreolC
while C W,alid
%oto#C1.25 clreolC
%oto#C1.24 clreolC %oto#C<2.25
co$t JGESI0
%oto#C3.1
co$t Do o$ wa"t to sa,e the record C9" '
2
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 30/52
do
M
li"e/!o#C1.1.<.23.21= ,alid 1
%oto#C42.1
ch %etcheC ch to$--erCch
if Cch YJY
ret$r" if Cch W YBY VV ch W YNY
M
,alid J
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C42.1 clreolC
while C W,alid
if Cch YBYM
&$esA"o tA&$esA"o
fstream file file/o-e"Cfile"ame. ios''a--
file/writeCCchar K this. sieofC&$i
file/closeC
tA&$esA"oRR
%oto#C<2.25
co$t JGESI0 %oto#C3.21
co$t Do o$ wa"t to add more &$estio"s C9" '
doM
li"e/!o#C1.1.<.23.21=
,alid 1
%oto#C45.21 ch %etcheC
ch to$--erCch
if Cch YJYret$r"
if Cch W YBY VV ch W YNY
M,alid J
so$"dC5JJ
delaC1JJ
"oso$"dC
3J
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 31/52
%oto#C45.21 clreolC
while C W,alid while Cch YBY
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' fo$"dArecord99 DE07IL ' I0 E7?+ 0+E I8EN E?OD IN 0+E
99 I8EN FILE 7ND E0UN J IF NO0 FOUND
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
i"t &$i '' fo$"dArecordCchar file"ameP13. i"t tA&$esA"o
M
fstream file
file/o-e"Cfile"ame. ios''i" file/see)%CJ.ios''!e%
i"t fo$"dJ while Cfile/readCCchar K this. sieofC&$i
M
if CtA&$esA"o &$esA"oM
fo$"dRR
!rea)
file/closeC
ret$r" fo$"d
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' dis-laArecord
99 DE07IL ' I0 DI:L7B 0+E E?OD FO 0+E I8EN99 QUE0ION NO/ FO@ 0+E I8EN FILE
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' dis-laArecordCchar file"ameP13. i"t tA&$esA"o
M
fstream file file/o-e"Cfile"ame. ios''i"
file/see)%CJ.ios''!e%
while Cfile/readCCchar K this. sieofC&$i
M
31
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 32/52
if CtA&$esA"o &$esA"o
M
%oto#C3.3 co$t &$estio" tA&$esA"o
%oto#C3.<
co$t &$estio" ' &$es %oto#C3.=
co$t a"swer 1 ' a"s1
%oto#C3. co$t a"swer 2 ' a"s2
%oto#C3.1J
co$t a"swer 3 ' a"s3
!rea)
file/closeC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' deleteArecord99 DE07IL ' I0 DELE0E 0+E E?OD FO 0+E I8EN
99 QUE0ION NO/ FO@ 0+E I8EN FILE
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' deleteArecordCchar file"ameP13. i"t tA&$esA"o
M
fstream file file/o-e"Cfile"ame. ios''i"
fstream tem-
tem-/o-e"Ctem-/dat. ios''o$t file/see)%CJ.ios''!e%
while CWfile/eofC
M
file/readCCchar K this. sieofC&$i if C file/eofC
!rea)
if C&$esA"o W tA&$esA"otem-/writeCCchar K this. sieofC&$i
file/closeC tem-/closeC
file/o-e"Cfile"ame. ios''o$t
tem-/o-e"Ctem-/dat. ios''i"
tem-/see)%CJ.ios''!e%
32
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 33/52
tA&$esA"o 1
while CWtem-/eofC
Mtem-/readCCchar K this. sieofC&$i
&$esA"o tA&$esA"o
if Ctem-/eofC !rea)
file/writeCCchar K this. sieofC&$i
tA&$esA"oRR
file/closeC
tem-/closeC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i99 FUN?0ION N7@E ' deletio"
99 DE07IL ' I0 I8E 0+E QUE0ION NO/ 0O DELE0E99 E?OD FO@ 0+E I8EN FILE
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' deletio"Cchar file"ameP13
M
li"es li"e
clrscrC i"t ,alid
i"t tA&$esA"oJ. t
char t1A&$esA"oP5 char ch
li"e/!o#C1.1.<.23.21=
%oto#C<2.25 co$t JGESI0
%oto#C3.3
co$t E"ter &$estio" "o/ to !e deleted '
do M
%oto#C3=.3
%etsCt1A&$esA"o while Cstrle"Ct1A&$esA"o J
t atoiCt1A&$esA"o
tA&$esA"o t if Ct1A&$esA"oPJ YJY
ret$r"
if CWfo$"dArecordCfile"ame.tA&$esA"o
M
33
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 34/52
so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C3.15
co$t &$estio" "ot fo$"d
li"e/li"eAhorC1.<.24.16 %oto#C1.25
co$t :ress a" )e to co"ti"$e///
%etchC ret$r"
clrscrC
li"e/!o#C1.1.<.23.21= dis-laArecordCfile"ame.tA&$esA"o
%oto#C3.12
co$t Do o$ wa"t to delete this ecord C9" '
do M
,alid 1 %oto#C45.12
ch %etcheC
ch to$--erCch if Cch W YBY VV ch W YNY
M
,alid J
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C45.1J clreolC
while CW,alid
if Cch YNYret$r"
%oto#C1.25
co$t (ait///
deleteArecordCfile"ame.tA&$esA"o clrscrC
so$"dC5JJ
delaC1JJ "oso$"dC
%oto#C3.14
co$t ecord Deleted li"e/li"eAhorC1.<.24.16
%oto#C1.25
co$t :ress a" )e to co"ti"$e////
%etchC
34
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 35/52
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' modifArecord99 DE07IL ' I0 @ODIFB 0+E E?OD FO 0+E I8EN
99 QUE0ION NO/ FO@ 0+E I8EN FILE
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' modifArecordCchar file"ameP13. i"t tA&$esA"o
M li"es li"e
i"t ,alid. modifiedJ
char ch
li"e/li"eAhorC2.<=.12.16 li"e/!o#C1.1.<.23.21=
%oto#C3.14 co$t QUE0ION tA&$esA"o
%oto#C3.16
co$t QUE0ION ' %oto#C3.1<
co$t 7N(E 1 '
%oto#C3.1=
co$t 7N(E 2 ' %oto#C3.1
co$t 7N(E 3 '
%oto#C3.2J co$t OLU0ION '
%oto#C1.25 clreolC
li"e/li"eAhorC1.<.23.16 %oto#C14.16
co$t ?ha"%e C9"
do
Mli"e/!o#C1.1.<.23.21=
,alid 1
%oto#C2=.16 ch %etcheC
ch to$--erCch
if Cch W YBY VV ch W YNYM
,alid J
so$"dC5JJ
delaC1JJ
35
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 36/52
"oso$"dC
%oto#C2=.16 clreolC
while CW,alid
,alid J
while CW,alid VV ch YBY M
li"e/!o#C1.1.<.23.21=
modified 1 ,alid 1
%oto#C14.16 clreolC
%oto#C<2.25
co$t JGESI0 %oto#C3.25
co$t EN0E QUE0ION
%oto#C14.16
%etsC&$es str$-rC&$es
if C&$esPJ YJYret$r"
if Cstrle"C&$es G15 XX strle"C&$es J
M,alid J
so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C1.25 clreolC
%oto#C1.24
co$t LEN0+ +OULD NO0 ;L7NT O E70E 0+7N 15 %oto#C1.25
co$t :ress a" )e to co"ti"$e///
%etchC %oto#C1.24 clreolC
%oto#C1.25 clreolC
%oto#C14.16 clreolC
%oto#C1.25 clreolC
%oto#C14.1< co$t ?ha"%e C9"
do
Mli"e/!o#C1.1.<.23.21=
,alid 1
%oto#C2=.1<
ch %etcheC
36
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 37/52
ch to$--erCch
if Cch W YBY VV ch W YNY
M,alid J
so$"dC5JJ
delaC1JJ "oso$"dC
%oto#C2=.1< clreolC
while CW,alid
,alid J
while CW,alid VV ch YBY
Mli"e/!o#C1.1.<.23.21=
modified 1
,alid 1
%oto#C13.1< clreolC %oto#C<2.25
co$t JGESI0 %oto#C3.25
co$t EN0E 7N(E FO 0+E QUE0ION
%oto#C14.1< %etsCa"s1
str$-rCa"s1
if Ca"s1PJ YJY
ret$r" if Cstrle"Ca"s1 G 4
M
,alid J so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C1.25 clreolC
%oto#C1.24
co$t LEN0+ +OULD NO0 E70E 0+7N 4
%oto#C1.25 co$t :ress a" )e to co"ti"$e///
%etchC
%oto#C1.24 clreolC %oto#C1.25 clreolC
%oto#C14.1< clreolC
%oto#C1.25 clreolC
%oto#C14.1=
co$t ?ha"%e C9"
3<
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 38/52
do
M
li"e/!o#C1.1.<.23.21= ,alid 1
%oto#C2=.1=
ch %etcheC ch to$--erCch
if Cch W YBY VV ch W YNY
M,alid J
so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C2=.1= clreolC
while CW,alid
,alid J while CW,alid VV ch YBY
Mli"e/!o#C1.1.<.23.21=
modified 1
,alid 1 %oto#C14.1= clreolC
%oto#C<2.25
co$t JGESI0
%oto#C3.25 co$t EN0E 7N(E FO 0+E QUE0ION
%oto#C14.1=
%etsCa"s2 str$-rCa"s2
if Ca"s2PJ YJY
ret$r" if Cstrle"Ca"s2 G 4
M
,alid J
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C1.25 clreolC %oto#C1.24
co$t LEN0+ +OULD NO0 E70E 0+7N 4
%oto#C1.25 co$t :ress a" )e to co"ti"$e///
%etchC
%oto#C1.24 clreolC
%oto#C1.25 clreolC
3=
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 39/52
%oto#C14.1= clreolC
%oto#C1.25 clreolC
%oto#C14.1
co$t ?ha"%e C9" do
M
li"e/!o#C1.1.<.23.21= ,alid 1
%oto#C2=.1
ch %etcheC
ch to$--erCch if Cch W YBY VV ch W YNY
M
,alid J
so$"dC5JJ delaC1JJ
"oso$"dC %oto#C2=.1 clreolC
while CW,alid ,alid J
while CW,alid VV ch YBY
M
li"e/!o#C1.1.<.23.21= modified 1
,alid 1
%oto#C14.1 clreolC %oto#C<2.25
co$t JGESI0
%oto#C3.25 co$t EN0E 7N(E FO 0+E QUE0ION
%oto#C14.1
%etsCa"s3
str$-rCa"s3 if Ca"s3PJ YJY
ret$r"
if Cstrle"Ca"s3 G 4M
,alid J
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C1.25 clreolC
%oto#C1.24
3
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 40/52
co$t LEN0+ +OULD NO0 E70E 0+7N 4
%oto#C1.25
co$t :ress a" )e to co"ti"$e/// %etchC
%oto#C1.24 clreolC
%oto#C1.25 clreolC %oto#C14.1 clreolC
if CWmodified
ret$r"
do
Mli"e/!o#C1.1.<.23.21=
%oto#C1.25 clreolC
,alid 1
%oto#C<2.25 co$t JGESI0
%oto#C3.25 co$t EN0E ?OE?0 OLU0ION FO 0+E QUE0ION C19293
%oto#C14.2J
sol %etcheC if Csol YJY
ret$r"
if Csol W Y1Y VV sol W Y2Y VV sol W Y3Y
M,alid J
so$"dC5JJ
delaC1JJ "oso$"dC
%oto#C14.2J clreolC
while CW,alid
%oto#C1.25 clreolC
%oto#C1.24 clreolC
%oto#C1.22 co$t Do o$ wa"t to sa,e the record C9" '
do
Mli"e/!o#C1.1.<.23.21=
,alid 1
%oto#C41.22 ch %etcheC
ch to$--erCch
if Cch W YBY VV ch W YNY
M
4J
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 41/52
,alid J
so$"dC5JJ
delaC1JJ "oso$"dC
%oto#C41.22 clreolC
while C W,alid
if Cch YNY
ret$r" fstream file
file/o-e"Cfile"ame. ios''o$t X ios''ate
i"t rec"o
rec"o tA&$esA"o i"t locatio"
locatio" Crec"oH1 K sieofC&$i
file/see)-Clocatio"
file/writeCCchar K this. sieofC&$i file/closeC
clrscrC so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C1.14
co$t ecord @odified
li"e/li"eAhorC1.<.24.16
%oto#C1.25 co$t :ress a" )e to co"ti"$e///
%etchC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' modif
99 DE07IL ' I0 I8E 0+E QUE0ION NO/ 0O @ODIFB
99 E?OD FO@ 0+E I8EN FILE99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' modifCchar file"ameP13
M
li"es li"e clrscrC
i"t ,alid
i"t tA&$esA"oJ. t
char t1A&$esA"oP5
41
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 42/52
char ch
li"e/!o#C1.1.<.23.21=
%oto#C<2.25 co$t JGESI0
%oto#C3.3
co$t E"ter &$estio" "o/ to !e modif ' do
M
%oto#C3=.3 %etsCt1A&$esA"o
while Cstrle"Ct1A&$esA"o J
t atoiCt1A&$esA"o
tA&$esA"o t if Ct1A&$esA"oPJ YJY
ret$r"
if CWfo$"dArecordCfile"ame.tA&$esA"o
M so$"dC5JJ
delaC1JJ "oso$"dC
%oto#C3.15
co$t &$estio" "ot fo$"d li"e/li"eAhorC2.<=.24.16
%oto#C1.25
co$t :ress a" )e to co"ti"$e///
%etchC ret$r"
clrscrC dis-laArecordCfile"ame.tA&$esA"o
%oto#C3.12
co$t Do o$ wa"t to modif this ecord C9" ' do
M
,alid 1
%oto#C45.12 ch %etcheC
ch to$--erCch
if Cch W YBY VV ch W YNYM
,alid J
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C45.1J clreolC
42
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 43/52
while CW,alid
if Cch YNY
ret$r" modifArecordCfile"ame.tA&$esA"o
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 ?L7 N7@E ' &$i99 FUN?0ION N7@E ' dis-laAscore
99 DE07IL ' I0 DI:L7B 0+E ?OE FO 0+E I8EN
99 :L7BEY N7@E
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' dis-laAscoreCchar "ameP2J. i"t -laed. i"t correct
M clrscrC
li"es li"e li"e/!o#C1.1.3.25.21=
li"e/!o#C2.2.3=.24.21
te#t!ac)%ro$"dC(+I0E te#tcolorC;L7?TR;LINT
%oto#C5.4
c-ri"tfC
%oto#C.4 c-ri"tfC ? O E ; O 7 D
te#t!ac)%ro$"dC;L7?T
te#tcolorCLI+07B %oto#C5.<
co$t :laerYs Name ' "ame
%oto#C5. co$t &$estio"s 7ttem-ted ' -laed
%oto#C5.11
co$t ?orrect a"swer ' correct
%oto#C5.13 co$t (ro"% a"swer ' -laedHcorrect
i"t score
score correct K 1J %oto#C5.16
co$t core ' score
i"t t-laed t-laed -laed K 1J
float -erce"ta%e
-erce"ta%e CCscoreK1JJ9t-laed
%oto#C5.1=
43
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 44/52
co$t :erce"ta%e ' -erce"ta%e
%etchC
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK99 ?L7 N7@E ' &$i
99 FUN?0ION N7@E ' -la
99 DE07IL ' I0 ?E70E ?EEN FO :L7BIN QUIZ99 0O 0+E :L7BE FO 0+E I8EN FILE N7@E
99 7ND TEE: ?OE/
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid &$i '' -laCchar file"ameP13
M
clrscrC i"t ,alid
li"es li"e char "ameP2J
%oto#C3.3
co$t E"ter o$r "ame ' do
M
li"e/!o#C1.1.3.25.21
,alid 1 %oto#C3J.24
co$t JGESI0
%oto#C21.3 %etsC"ame
str$-rC"ame
if C"amePJ YJYret$r"
if Cstrle"C"ame G 1=
M
,alid J so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C3J.24
co$t
%oto#C3.23 co$t LEN0+ +OULD NO0 E70E 0+7N 1=
%oto#C3.24
co$t :ress a" )e to co"ti"$e///
%etchC
44
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 45/52
%oto#C3.23
co$t
%oto#C3.24 co$t
%oto#C21.3
co$t
while C W,alid
char tAsol. ch i"t correctJ. -laedJ
fstream file
file/o-e"Cfile"ame.ios''i"
file/see)%CJ.ios''!e% while Cfile/readCCchar K this. sieofC&$i
M
clrscrC
li"e/!o#C1.1.3.25.21 %oto#C25.3
co$t ?OE' correctK1J ,alid 1
%oto#C2=.24
co$t E?GE#it %oto#C3.4
co$t &$estio" &$esA"o
%oto#C3.6
co$t &$estio" ' &$es %oto#C3.1J
co$t a"swer 1 ' a"s1
%oto#C3.11 co$t a"swer 2 ' a"s2
%oto#C3.12
co$t a"swer 3 ' a"s3 %oto#C3.14
co$t E"ter correct sol$tio" '
i"t iJ. >J. time1J
doM
,alid 1
%oto#C3.21 co$t 0ime ' time
%oto#C2=.12
doM
delaC1
iRR
>RR
45
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 46/52
if C> 6JJ
M
> J timeHH
%oto#C11.21
co$t %oto#C1J.21
co$t time
%oto#C2=.14
while CW)!hitC VV i6JJJ
if Ci G 6JJJ
M -laedRR
so$"dC5JJ
delaC1JJ
"oso$"dC %oto#C13.16
co$t orr 0ime $-W %oto#C1.1
%etchC
if C-laeddis-laAscoreC"ame.-laed.correct
ret$r"
%oto#C3.21 co$t
%oto#C2=.12
tAsol %etcheC if CtAsol 2<
M
if C-laeddis-laAscoreC"ame.-laed.correct
ret$r"
if CtAsol W Y1Y VV tAsol W Y2Y VV tAsol W Y3YM
,alid J
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C2=.12 co$t
while CW,alid
-laedRR
46
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 47/52
if CtAsol W sol
M
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C14.16 co$t wro"% a"swer
%oto#C13.1<
co$t ?orrect a"swer ' sol %oto#C1.1
ch %etchC
%oto#C14.15
co$t %oto#C13.16
co$t
%oto#C3.24
co$t
elseM
correctRR
so$"dC5JJ delaC1JJ
"oso$"dC
%oto#C16.16
co$t OOD W ?OE?0 7N(E %oto#C25.3
co$t ?OE' correctK1J
%oto#C1.1 ch %etchC
if Cch 2<M
dis-laAscoreC"ame.-laed.correct
ret$r"
%oto#C3.22
co$t No more &$estio"s a,aila!le %etchC
if CW-laed
ret$r" dis-laAscoreC"ame.-laed.correct
4<
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 48/52
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 FUN?0ION N7@E ' mai"
99 DE07IL ' I0 ?7LL 0+E 070 FUN?0ION 7ND99 @ENU FUN?0ION/
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
,oid mai"C,oid
M me"$ m
m/startC
m/mai"Ame"$C
99KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
99 END OF :OE?099KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
4=
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 49/52
?EEN +O0• FON0 :7E
• @ENU :7E
4
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 50/52
1/U;H@ENU
2/7DD QUE0ION
5J
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 51/52
51
7/23/2019 Project Computer Quiz
http://slidepdf.com/reader/full/project-computer-quiz 52/52
• 7F0E QUE0ION I 7DDED
• QUI0