给写简单的VB列子。循环。判断。。。。。
来源:百度知道 编辑:UC知道 时间:2024/06/12 08:28:08
给我写VB的简单的例子。。简单的运算的。反正是简单就可以了。是关于循环。判断。等常见结构的,,谢谢!!!!
(1)for i = 1 to 5
s = s + i
next i
print s
第一题计算 1到5之间的所有数之和
(2)if text1 = "你好" then
msgbox "你输入了你好"
else
msgbox "你输入了不是你好"
end if
(3) i = 6
do while i >=5
s = s + i
i = i + 1
loop
int i = 0
do '循环
i = i + 1
if i = 10 then 'if判断
exit do'退出循环
end if
loop
当i为10时退出。
if语句判断
dim year as interger'判断是否是闰年
if (year mod 4=0 and year mod 100<>0 ) or year mod 400=0 _
then print year;"是闰年"
else print year;"不是闰年"
endif
for循环
for i=1 to 100'for循环 求1+2+……+100的和
sum = sum +i
next
for i = 1 to 100 '从1到100进行循环
if i=10 then '判断 I=10的时候 则打印出i
print i
end if
next i