1楼:匿名用户
option explicit
private sub command1_click()dim d(1 to 10) as integerdim i as integer
dim n as integer
dim x as integer
dim mymax as integer
dim kmax as integer
dim t as integer
randomize
n = 0
do while n < 10
x = int(rnd * 90 + 10)for i = 1 to n
if x = d(n) then exit fornext i
if i > n then
n = n + 1
d(n) = x
end if
loop
me.cls
'输出数组
for i = 1 to 10
print d(i),
next i
'寻找最大值并输出下标
mymax = d(1)
kmax = 1
for i = 2 to 10
if d(i) > mymax then
mymax = d(i)
kmax = i
end if
next i
print "最大值:" & mymax
print "在第" & kmax & "元素里。"
'交换元素的值
for i = 1 to 5
t = d(i)
d(i) = d(10 - i + 1)
d(10 - i + 1) = t
next i
'再次输出数组
for i = 1 to 10
print d(i),
next i
end sub
2楼:听不清啊
private sub command1_click()randomize
dim a(10) as integer
print "原来的数组:"
for i = lbound(a) to ubound(a)a(i) = int(100 * rnd()): print a(i);
next
abc a()
end sub
sub abc(a() as integer)max = lbound(a())
for i = lbound(a) to ubound(a)if a(i) > a(max) then max = inext
print "max:"; "a("; max; ")="; a(max)
print: print "逆置数组后:"
i = lbound(a)
j = ubound(a)
while i < j
t = a(i): a(i) = a(j): a(j) = ti = i + 1: j = j - 1
wend
for i = lbound(a) to ubound(a)print a(i);
next
end sub
跪求大神帮忙用vb程序写这道题!!!
3楼:
private sub command1_click()dim ts as integer,tv0 integer, tv1 as integer,ta as integer,tt as integer
tv0=40*1000/3600
tt=2*60
'先化简,统一各单位 v=40km/h=100/9 m/s ,a = 0.15 m/s, t=120 s
tv1=tv0+ta*tt '由公式v2=v1+at得ts=tv0*tt+ta*(tt)^2/2 '由公式s=v0t+at^2/2得
text1.text=tv1 '2min后速度vtext2.text=ts '距开始点的距离send sub
‘必要的话可以进行单位换算
求大神帮忙看下这道vb编程题
4楼:匿名用户
这个题目的考察点在于随机数,还有程序的逻辑关系。我去年做了这个程序,给你瞧瞧?
求vb大神帮忙做一道题。要求;只需要要程序写出来,界面的截图;
5楼:匿名用户
基本思路,是把数字作为字符串处理,然后运算的时候,先把它截取成长度一定的(比如4位)若干段,分段转换成数字求和(要考虑进位),然后转换成字符,在连接起来输出:
界面如下:
**如下:
option explicit
private sub command1_click()
dim ssss as string
ssss = ppp(text1.text, text2.text)
text3.text = ssss
end sub
'自定义函数求两个长整数之和
private function ppp(byval s1 as string, byval s2 as string) as string
dim dd1() as string
dim n1 as integer
dim dd2() as string
dim n2 as integer
dim s as string
dim i as integer
dim d1 as integer
dim d2 as integer
dim t as integer
dim j as integer
dim jinwei as boolean
dim k as integer
dim ss1 as string
dim ss2 as string
if len(s1) > len(s2) then
ss1 = s1
ss2 = s2
else
ss1 = s2
ss2 = s1
end if
n1 = 0
s = ss1
do while len(s) > 4
n1 = n1 + 1
redim preserve dd1(1 to n1) as string
dd1(n1) = right(s, 4)
s = left(s, len(s) - 4)
loop
n1 = n1 + 1
redim preserve dd1(1 to n1) as string
dd1(n1) = s
n2 = 0
s = ss2
do while len(s) > 4
n2 = n2 + 1
redim preserve dd2(1 to n2) as string
dd2(n2) = right(s, 4)
s = left(s, len(s) - 4)
loop
n2 = n2 + 1
redim preserve dd2(1 to n2) as string
dd2(n2) = s
jinwei = false
k = 0
for i = 1 to n1
k = k + 1
if k > n2 then exit for
if not jinwei then
t = val(dd1(i)) + val(dd2(k))
else
t = val(dd1(i)) + val(dd2(k)) + 1
end if
if len(cstr(t)) > 4 then
jinwei = true
else
jinwei = false
end if
dd1(i) = right(cstr(t), 4)
next i
if jinwei then
for i = n2 + 1 to n1
if jinwei then
t = val(dd1(i)) + 1
else
t = val(dd1(i))
end if
if len(cstr(t)) > 4 then
jinwei = true
else
jinwei = false
end if
dd1(i) = right(cstr(t), 4)
next i
end if
ppp = ""
for i = n1 to 1 step -1
ppp = ppp & dd1(i)
next i
if jinwei then ppp = "1" & ppp
end function
【急】一道vb题目,求大神帮忙!
6楼:小
这个弯路绕大了,36!=3.71993e+41, 是个亿亿亿亿亿级的数字,vb中没有什么数据类型能精确存放它的结果,而36!
/7!/(36-7)!只需要算(36*35*34*33*32*31*30)/(1*2*3*4*5*6*7)就行了。
7楼:匿名用户
记住你了,以后再也不会鸟你的问题了,回答我也删除掉
求大神帮忙,用vb设计程序,有两个题目
vb作业题,编写程序,求s 1 2 3n的值。其中n值
1楼 听不清啊 private sub mand1 click n cint inputbox 求 bain!, du请输zhi 入daon的值 版 s 1 for i 2 to n s s i next i msgbox n 权 s end sub 2楼 匿名用户 private sub form...
求大神帮忙解答,求大神帮忙解答这道题,急!!!
1楼 天长地久喽 一知半解 拼音 y zh b n ji 释义 知道得不全面,理解得也不透彻。 出处 宋 严羽《沧浪诗话 诗辨》 有透彻之悟,有但得一知半解之悟。 例句 他的讨厌之处是对什么科学知识都大发议论 其实都是一知半解。 求大神帮忙解答这道题,急!!! 2楼 吾乃至尊杀机 题目是不是少了东西...
求大佬给一下解题过程,谁会这几题帮忙写一下解题过程跪求大佬解答?
1楼 好人好梦走天下 数学题吗?问老师吧。 2楼 周总 在风水上讲,进门直对餐桌 床铺 卫生间等都是不好的。你可以调动一下餐桌的位置吗,只要不是直对门就好。也可在两者之间用屏风之类的东西隔一下。 说实在的,有些事情信则有,不信则无。要是你特别在意这件事,那就找个风水大师给认真的看看。祝你好运! 谁会...