Computer Science Canada

score counting, hrlp plz

Author:  CHUTHAN20 [ Fri May 28, 2004 8:21 pm ]
Post subject:  score counting, hrlp plz

code:
var answer:int:=2
var answer1:string
var answer2:string
var count:int:=0
put "What is the capital city of Alberta?"
get answer1
if answer1 = "Edmonton" then
end if
cls
put "What is the Capital city of British Columbia"
get answer2
if answer2 = "Victoria" then
end if
cls



I want like,

at the end, there is total 13 so like you got "13 out of 13".

Author:  guruguru [ Fri May 28, 2004 9:42 pm ]
Post subject: 

If you get an answer right, your count will go up one. Like the code you have, add in count += 1 when they get the right answer. As well, you'll want to check for lower case answers for those lazy people :p.

code:

var answer : int := 2
var answer1 : string
var answer2 : string
var count : int := 0
put "What is the capital city of Alberta?"
get answer1
if answer1 = "Edmonton" or answer1 = "edmonton" then
    count += 1
end if
cls
put "What is the Capital city of British Columbia"
get answer2
if answer2 = "Victoria" or answer2 = "victoria" then
    count += 1
end if
cls
put "You got ", count, " out of 2."


: