1楼:听不清啊
private sub ***mand1_click()
dim m as integer, n as integer
m = inputbox("请输入矩阵的行数:")
n = inputbox("请输入矩阵的列数:")
dim a(20, 20) as integer
m1 = 1: n1 = 1: m2 = 1: n2 = 1
randomize
for i = 1 to m
for j = 1 to n
a(i, j) = rnd * 90 + 10
print a(i, j);
if a(i, j) > a(m1, n1) then m1 = i: n1 = j
if a(i, j) < a(m2, n2) then m2 = i: n2 = j
next j
next i
print "最大值: a(" & m1 & "," & n1 & ")=" & a(m1, n1)
print "最小值: a(" & m2 & "," & n2 & ")=" & a(m2, n2)
end sub
求vb大佬看看这哥问题如何解决 谢谢!!
2楼:匿名用户
public function jiecheng(byval n as integer) as integer
dim jc as integer = 1
for i = 1 to n
jc = jc * i
next
return jc
end function
public function jiecheng(byval n as integer) as double
dim jc as double
jc = 1
for i = 1 to n
jc = jc * i
next
jiecheng = jc
end function
private function factorial1(intn as integer) as integer
'采用递归计算阶乘
if intn = 0 then
factorial1 = 1
else
factorial1 = factorial1(intn - 1) * intn
end if
end function
给你几个阶乘的函数,你可以直接调用阶乘的函数去做哦
3楼:匿名用户
option explicit
private sub ***mand1_click()
dim m as double, n as double
inputdata m, "m"
inputdata n, "n"
if m < n then
print "***bination(" & m & "," & n; ")=" & 0
else
print "***bination(" & m & "," & n; ")=" & factorial(m) / (factorial(n) * factorial(m - n))
end if
end sub
public sub inputdata(byref t, byval char as string)
t = inputbox(char + "=", "输入框", 25)
if int(val(t)) <> val(t) or val(t) < 0 then
msgbox "数据错误!
请重新输入:", 16
inputdata t, char
end if
end sub
public function factorial(byval r)
dim i as integer
factorial = 1
for i = 1 to r
factorial = factorial * i
next i
end function
vb编程问题求大佬解答?
4楼:匿名用户
溢出错误就是变量定义的类型太小 不够承载其数值大小 你运行后看黄色错误行落在哪一行 再去分拆公式看具体错误是由于哪个变量导致的 再做修改
求vb大佬帮忙解决一下!!谢谢
5楼:听不清啊
private sub ***mand1_click()randomize
dim a as long, b as long, n as integer
a = rnd * 1000 + 1
do while true
b = rev(a)
if b = a or n = 7 then exit doprint a; "+"; b; "="; a + ba = a + b
n = n + 1
loop
end sub
function rev(byval x)while x > 0
y = y * 10 + x mod 10x = x \ 10
wend
rev = y
end function
求大佬解答vb的疑问,随机出现空值是怎么回事?if i=0 的条件为啥触发不了?
6楼:网海1书生
i=0的判断条件应该放到最前面去,否则的话,text1.text的值等于c,大于c,小于c,这三个条件加起来已经占据了100%的可能性(也就是说这三个条件必定有一个是true的),这样的话i=0放到最后就永远也没有运行的机会了。
此外,一定要注意类型的转换。
下面是修改后的**:
dimaasinteger,basinteger,casinteger,iasinteger'你的变量声明是错的
privatesub***mand1_click()
randomize
a=val(inputbox("输入最小值"))'用val可以防止输入非数字造成出错
b=val(inputbox("输入最大值"))
label2.caption=a&"~"&b&"之间"
c=int(rnd*(b-a+1)+a)
endsub
privatesub***mand2_click()
ifi=0then
msgbox"没机会了"'弹框可以防止程序直接退出无法看到提示
endelseifval(text1.text)=cthen
label4.caption="猜对了"
i=5'猜对了就要把次数恢复,否则下次就无法再运行了
elseifval(text1.text)>cthen
b=val(text1.text)'这是动态调整剩余数的范围
label4.caption="猜大了,还有"&i&"次机会"
label2.caption=a&"~"&b&"之间"
i=i-1
elseiftext1.text a=val(text1.text)'同上 label4.caption="猜小了,还有"&i&"次机会" label2.caption=a&"~"&b&"之间" i=i-1 endif endsub privatesubform_load() i=5 endsub 求大佬给用vb2010编写一个小游戏,像石头剪刀布啊什么的,求大佬帮帮忙啦! 7楼:匿名用户 做过打地鼠,五子棋,记忆力测试,贪吃蛇,配对游戏,什么的。看你想要什么样子的游戏咯。 求vb大佬看看!!谢谢!!**怎么写!! 8楼:匿名用户 本程序使用了控件数组: **:private type student stu_id as string name as string *** as string politicalorientation(1) as string end type private sub ***mand1_click() dim stud as student with stud .stu_id = text1.text .name = text2.text for i = 0 to 1 if option1(i).value then .*** = option1(i).caption if check1(i).value then .politicalorientation(i) = check1(i).caption else .politicalorientation(i) = "非" + check1(i).caption end if next i picture1.print "学号:" + .stu_id picture1.print "姓名:" + .name picture1.print "性别:" + .*** picture1.print "政治面貌1:" + .politicalorientation(0) picture1.print "政治面貌2:" + .politicalorientation(1) picture1.print write #1, .stu_id; .name; .***, .politicalorientation(0); .politicalorientation(1) close #1 end with end sub 运行效果: 9楼: 可以实现的哈,戳头像取数字要答案 10楼:匿名用户 追加写文件 dim s as string dim filename as stringfilename = shuxiang & xingzuo & ".txt" open filename for input as #1do while not eof(1) line input #1, s print s loop close #1 编程问题,求大佬帮忙 11楼:aaa软件教育 如果有心从事编程方向的工作,最好到专业机构深入学习、多实践,更贴近市场,这样更有利于将来的发展。建议考虑时下火爆的python,python不仅入门简单,灵活高效。更是在人工智能方面应用广泛,对将来大有裨益 1楼 匿名用户 private sub mand1 click dim fh as string fh inputbox 请输入运算符 , , , me cls select case fh case is me print val text1 val text2 val text1 val tex... 1楼 好人缘好让他 2 4 诗中亲情2 5 诗中乡情2 6 作者出处2 7 三境界2 8 正所谓 猜你关注唐诗宋词 中国文学史上的两颗明珠 编辑唐诗宋词是中国文学史上的两颗明珠,唐代被称为诗的时代,宋代被称为词的时代。 词源于民间,始于唐,兴于五代,盛于两宋。宋代物质生活的丰富,人们对文化生活的追求... 1楼 匿名用户 我的也有这种情况,一般可能是你安装软件过多或是软件不兼容所致,小米的miui系统稳定版确实很糟糕,你还是刷机吧,刷成开发版吧。 2楼 ak200老枪 正常你以为小米就那么好吗?那么无敌吗。小米公司养了无数的水军只要你发个帖说你要买手机保证就有人跟你说买小米。不信你试试 3楼 匿名用户...VB问题,求大佬解答,vb编程问题求大佬解答?
VB题,求大佬解释,求大佬解释以下vb代码,每一步的详细解释!!!
求高手回答小米手机的问题,求高手解决小米手机的问题啊~~