E
Erik Boling
I have been trying to get find a way to get input from the user, and be
able to store in a variable using shoes GUI, but i can't quite figure it
out? Does any one know how to? I know you can *replace* but that not
working for what im trying to do... if ur wondering, heres the program
that im trying to put a GUI on..
@correct = 0
@total = 0
def pose_multiplication_problem
@total = @total + 1
multiple2 = rand(11)
multiple1 = rand(11)
answer = multiple1 * multiple2
puts "What is #{multiple1} * #{multiple2} ?"
answerp = gets.chomp.to_i
if answer == answerp
puts "Good job"
@correct = @correct + 1
else
puts 'Sorry, you fail, correct answer is ' + answer.to_s
end
end
puts 'How many problems do you want to solve?'
this_many = gets.chomp.to_i
oldtime = Time.now
this_many.times do
pose_multiplication_problem
end
puts @correct.to_s + '/' + @total.to_s + 'correct'
able to store in a variable using shoes GUI, but i can't quite figure it
out? Does any one know how to? I know you can *replace* but that not
working for what im trying to do... if ur wondering, heres the program
that im trying to put a GUI on..
@correct = 0
@total = 0
def pose_multiplication_problem
@total = @total + 1
multiple2 = rand(11)
multiple1 = rand(11)
answer = multiple1 * multiple2
puts "What is #{multiple1} * #{multiple2} ?"
answerp = gets.chomp.to_i
if answer == answerp
puts "Good job"
@correct = @correct + 1
else
puts 'Sorry, you fail, correct answer is ' + answer.to_s
end
end
puts 'How many problems do you want to solve?'
this_many = gets.chomp.to_i
oldtime = Time.now
this_many.times do
pose_multiplication_problem
end
puts @correct.to_s + '/' + @total.to_s + 'correct'