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

Username:   Password: 
 RegisterRegister   
 Please help this is worth 30% of my grade! URGENT!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xboxdude_6262




PostPosted: Mon Jun 15, 2015 9:23 pm   Post subject: Please help this is worth 30% of my grade! URGENT!

Sorry for posting this again but nobody is responding! Ok so im making a game and im using arrays (you get better marks). I want it so if they get the question right they get a point, but if they get it wrong they dont. it works as in if they get it wrong they get no points, but when they do get the question correct, it gives them a point and if they get another answer correct it wont give them another point. there points will always stay at 1.

Here is my code:


var Math_q : array 1 .. 4 of string := init ("What 10 + 13?", "What 154 + 36?", "What 7 * 8?", "What 13 * 21?")
var Math_a : array 1 .. 4 of string := init ("23", "190", "56", "273")
var answer : string
var score : int := 0
var scores : int := 0

proc Mathq



for i : 1 .. upper (Math_q)
put Math_q (i)
get answer

if answer = Math_a (i) then

scores := score + 1

end if


put scores
end for

end Mathq





Mathq
Sponsor
Sponsor
Sponsor
sponsor
andrew.




PostPosted: Mon Jun 22, 2015 4:32 pm   Post subject: RE:Please help this is worth 30% of my grade! URGENT!

Look at your 'score' and 'scores' variables a little more closely. Could you possibly use 1 variable to store the user's score?
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: