怎样用VB随机生成数学题目并判断计算结果

来源:百度知道 编辑:UC知道 时间:2024/05/13 06:18:44
http://p15.freep.cn/p.aspx?u=v20_p15_p_0709292122364855_0.bmp
单击出题,三个标签框随机生成一个算式,如4+5,6*7,45-48,之类的简单四则运算
在文本框中输入结果后,单击确定,,若答案正确,弹出对话框"正确"
若答案错误 ,弹出对话框"错误",并给出正确答案
设置如图http://p15.freep.cn/p.aspx?u=v20_p15_p_0709292122364855_0.bmp

看不到你的图
针对字面问题回答:
出三个随机函数
randomize
int a,int b,int result
a = fix(rnd*99):b=fix(rnd*99)
第三个确定符号
signal = fix(rnd*4)
select signal
case 1
result = a + b
case 2
result = a - b
case 3
result = a * b
case 4
result = a / b
end select

判断对错

if result = a + b then

当然要注意result和a,b的传递问题,用与学习的话最好声明成到函数之外。

这是个思路,不是最后代码哈