数学科 [英] Maths Division

查看:38
本文介绍了数学科的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人可以帮助我解决分工问题我有一个使用VB6的b
$ b。我正在编写一个程序,要求用户给出一个给定总和的正确答案,它应该给出两个可以很容易划分的数字

一个8岁的人,它应该是一个没有逗号部分

例如它应该给出一个像10/2而不是19/3的总和。

是否有某种类型的测试,我可以让它在它问之前运行这个问题是为了确保较大的数字可以用较小的数字来表示非逗号的答案,例如:3,4567或类似的东西,它应该最好只是一个1位的答案。


我的代码看起来像这样


Dim a,b,c为Long

a = 1 + Int(Rnd * 12)

b = 1 + Int(Rnd * 12)

c = a / b


Label2.Caption = a

Label3 .Caption = b

Label4.Caption = c


工作正常,但对8岁的孩子不好,如果可以的话请帮忙


谢谢

Hi, is there anyone who can help me with a division problem i;m having
I an using VB6. I am writing a program wich asks the user to give the correct answer to a given sum, it should give two number which can be easily divided
by a 8 year old and it should be a answer without the comma part
for instance it should give a sum like 10 / 2 and not 19 / 3.
Is there some type of test that i can let it run before it asks the question to make sure that the greater number is diviseable by the smaller number to give an non comma answer eg: 3,4567 or something the like, it should preferably just be a 1 digit answer.

my code looks like this

Dim a, b ,c as Long
a = 1 + Int(Rnd * 12)
b = 1 + Int(Rnd * 12)
c = a / b

Label2.Caption = a
Label3.Caption = b
Label4.Caption = c

which work fine but not good for an 8 year old, please help if you can

Thanks

推荐答案

试试这个

将a,b,c调整为整数

a = Int(Rnd * 12)+1

b = Int(Rnd * 12)+ 1

c = a / b

如果a> b然后

c = b / a

其他

c = a / b

结束如果


Label2.Caption = a

Label3.Caption = b

Label4.Caption = c


告诉我它是否有效我只是在猜测

:)
try this
Dim a, b ,c as integer
a = Int(Rnd * 12)+1
b = Int(Rnd * 12)+ 1
c = a / b
if a > b then
c = b / a
else
c = a / b
end if

Label2.Caption = a
Label3.Caption = b
Label4.Caption = c

tell me if it work im just guessing
:)


确定这是怎么回事,它给出了一个总和例如

9 ÷7 = 1这是真的,因为7确实进入了9次,但是有一个余下的2

它是doesent show,那就是使用/运算符,对象是得到两个

数字可以用一个8 / b
岁可以理解的答案来划分,比如10÷2或8÷4,问题所在,得到

数字除以剩余部分


感谢您的回复非常感谢

问候

Sunray
ok what happens is this, it gives a sum for example
9 ÷ 7 = 1 which is true because 7 does go into 9 once but there is a remainder 2
which it doesent show, thats using the / operator, the object is to get two
numbers that can be divided with an answer that is comprehendable by an eight
year old, something like 10 ÷ 2 or 8÷4, that where the problem lies, getting
number to divide without remainders

Thanks for your reply it is greatly appreciated
Regards
Sunray


给定两个数字,你应该能够通过这样的结果检查结果是否是整数...
Given two numbers, you should be able to check whether the result is a whole number by something like this...
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


这篇关于数学科的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆