Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 score counting, hrlp plz
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CHUTHAN20




PostPosted: 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".
Sponsor
Sponsor
Sponsor
sponsor
guruguru




PostPosted: Fri May 28, 2004 9:42 pm   Post subject: (No 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."
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: