VB 判断循环

来源:百度知道 编辑:UC知道 时间:2024/06/06 01:29:03
用for if

如果我有说错 用非if判断
同时输出多个答案
可行不?
如:从1到10 能被2整除 运行打印 "s";

输出结果 s s s s s
if后运行一段代码呢? 如
Dim i, x, y
ScaleMode = 3
DrawWidth = 5
For i = 1 To 200
x = Rnd * ScaleWidth
画5次
y = Rnd * ScaleWidth
PSet (x, y), QBColor(Rnd * 15)
Next i

for i=1 to 10
if i mod 2 =0 then print "S" ;

next i

for i=1 to n'(N表示从1到几)
if i mod 2 = 0 then print "s";
next i

程序部分就不写了,说几个重点
dim a as string //用来存放结果
a=""

if 。。。。(你的条件)
a=a & " " & "结果"
end if

把上面的判断部分放入一个循环运行结束后,输出a即可