2个回答
展开全部
Dim n%, st$ 'st为控制所显示字符或数字变量
n = InputBox("请输入数字菱形行数,必须为奇数", "数字菱形")
m = (n + 1) / 2
For i = 1 To m
st = Chr(Asc(i))
Print Tab(m + 1 - i); String(2 * i - 1, st),
Next
For i = m + 1 To n
st = Chr(Asc(i))
Print Tab(i - m + 1); String(2 * (n - i) + 1, st),
Next
n = InputBox("请输入字符行数,必须为奇数", "字符菱形")
m = (n + 1) / 2
For i = 1 To m
If i Mod 2 = 0 Then st = "B" Else: st = "A"
Print Tab(m + 1 - i); String(2 * i - 1, st),
Next
For i = m + 1 To n
If i Mod 2 = 0 Then st = "B" Else: st = "A"
Print Tab(i - m + 1); String(2 * (n - i) + 1, st),
Next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询