点A、B的坐标分别为(100,100)、(300,300),当点A、B的颜色值分别为0xFFFFFF、0xFF0000时,就点击(200,200)。代码为: if ________ then touchdown(0, 200, 200) mSleep(100) touchup(0) end 横线处应填写的代码为
查看答案
D. getColor(100,100) == 0xFFFFFF and getColor(300,300) == 0xFF0000
用户在脚本配置界面设置i_max,当i大于或等于i_max时,提示“完成”。代码为: UI = { { 'InputBox{3}','i_max','局数:'}, } function main() i = 3 if __________ then notifyMessage('完成', 3000) end end 横线处应填写的代码为
在制作收费脚本时,常使用网络验证来对注册用户授权。假设下面这段代码里,date为从服务器获取的已注册用户的设备ID列表,需要判断用户是否注册。如果date中有用户的设备ID,则提示“验证成功”。请在横线处填上合适的代码。 date = 'ABCD|EFGH|IJKL' ID = getDeviceID() if __ (date, ID) ~= nil then notifyMessage('验证成功', 3000) end
设计一个求解方程“ax2 + bx + c = 0”的程序。 要求能在UI界面设置参数a、b、 c的值,并将方程的根(保留两位小数)以文字提示框的方式输出。仅考虑实数域,不考虑复数域。
查看答案
UI = { { 'TextView{方程:ax^2 + bx + c = 0}'}, { 'InputBox{}','a','a:'}, { 'InputBox{}','b','b:'}, { 'InputBox{}','c','c:'}, } function main() if a == '' or b == '' or c == '' then notifyMessage('请输入参数的值!', 3000) else a, b, c = tonumber(a), tonumber(b), tonumber(c) if a == nil or b == nil or c == nil then notifyMessage('参数输入不合法!', 3000) else if a == 0 then if b ~= 0 then x1 = -1 * (c/b) notifyMessage(string.format('x = %.2f', x1), 3000) else notifyMessage('方程没有根', 3000) end else del = b*b - 4*a*c if del >= 0 then x1 = ( -1*b + math.sqrt(del)) / (2*a) x2 = ( -1*b - math.sqrt(del)) / (2*a) notifyMessage(string.format('x1 = %.2f , x2 = %.2f', x1, x2), 3000) else notifyMessage('方程没有根', 3000) end end end end end