ios - Converting string to int for check answer -
for math question app have 2 random numbers generated have 4 buttons answers. want check answer if user pushes right button seems not work.
num1 , num2 labels random numbers generated in technically
num1.text = "(randomnum1)"
and num2.text = "(randomnum2)" thanks.
i have following code under button1 ibaction
var sum = (num1) + (num2) if btn1.titlelabel = (sum){ check.text = "right" }
maybe should convert before add num1 , num2. (convert strings integers before adding them up, also, should convert string integer fisrt when comparing sum , btn.titlelabel)
Comments
Post a Comment