
-----------------------------------
xboxdude_6262
Mon Jun 15, 2015 9:23 pm

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

-----------------------------------
andrew.
Mon Jun 22, 2015 4:32 pm

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?
