VB循环语句设置图案。怎么最简单的编辑出来?

2025-01-25 07:54:32
推荐回答(2个)
回答1:

给个思路:
dim strLen as int
dim lineLen as int
dim i as int
dim str, str0, str1 as string
strLen=4
lineLen=4
for i=1 to lineLen
str0 = Replicate("*", i) + space(strLen - i)
str1 = Reverse(str0)
str = str0 + str1
'显示str出来
next i

回答2:

for i=1 to 4
for j=1 to 8
if j<=i then
print tab(2*j);"*";
else
if j<(8-i) then
print tab(2*j);"";
else
print tab(2*J);"*"
end if
end if
next j
next i