0
我在做這個Lua代碼有什麼問題? 我正在嘗試生成兩個隨機數,並詢問它們在一起倍增。 第一部分是好的,但不管我輸入什麼答案,它總是認爲它是不正確的。 請告訴我我做錯了什麼,以及如何解決它。請記住這是Lua。Lua和用戶輸入
math.randomseed(os.time())
local a=math.random(10)
local b=math.random(10)
local answer
repeat
io.write("What is ",a,"*",b,"?")
io.flush()
answer=io.read()
if answer==a*b then
print("Correct!")
else
print("Try Again")
end
until
answer==a*b
謝謝凱文。非常有幫助 – user2059810 2013-03-15 23:08:04
@ user2059810歡迎來到stackoverflow!考慮接受凱文的答案(通過點擊複選標記)給他一些榮譽,並向未來的訪問者展示你的問題已經解決(以及如何) – 2013-03-16 00:00:12