郑州轻院计算机语言VB图形题题库
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
编写程序,使用双循环输出下列三角形
D D D D D D D
C C C C C
B B B
A
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, j As Integer
Dim str1 As String
Dim p As String = "D"
For i = 1 To 4
str1 = str1 + Space(2 * i)
For j = 1 To 9 - i * 2
str1 = str1 + p + " "
Next
str1 = str1 + Chr(10)
p = Chr(Asc(p) - 1)
Next
MsgBox(str1)
End Sub
写程序,使用双循环输出下列三角形
4444444
33333
222
1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, j As Integer
Dim str1 As String
Dim P as integer = 4
For i = 1 To 4
str1 = str1 + Space(2 * i)
For j = 1 To 9 - 2* i
str1 = str1 + Str(p)
Next
str1 = str1 + Chr(10)
p=p-1
Next
MsgBox(str1)
End Sub
写程序,使用双循环输出下列三角形
m n o p q r s
m n o p q
m n o
m
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, j As Integer
Dim p, str1 As String
p = "m"
For i = 1 To 5
For j = 1 To 9 - 2 * i
str1 = str1 + p + " "
p = Chr(Asc(p) + 1)
Next
str1 = str1 + Chr(10)
p = "m"
Next
MsgBox(str1)
End Sub
编写程序,输出下列三角形: 1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, j, data As Integer
Dim str1 As String
str1 = "" : data = 1
For i = 1 To 4
str1 = str1 + Space(8 - 2 * i)
For j = 1 To 2 * i - 1
str1 = str1 + Str(data)
Next
str1 = str1 + Chr(10)
data = data + 1
Next
MsgBox(str1)
End Sub
编写程序,使用双循环输出下列三角形:
A
A B C
A B C D E
A B C D E F G
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, j, data As Integer
Dim str1 As String
str1 = ""
For i = 1 To 4
data = Asc("A")
str1 = str1 + Space(8 - 2 * i)
For j = 1 To 2 * i - 1
str1 = str1 + Chr(data) + " "
data = data + 1
Next
str1 = str1 + Chr(10)
Next
MsgBox(str1)
End Sub
编写程序,输出下列三角形:
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, j, data As Integer
Dim str1 As String
str1 = ""
For i = 1 To 4
data = 1
str1 = str1 + Space(8 - 2 * i)
For j = 1 To 2 * i - 1
str1 = str1 + Str(data)
data = data + 1
Next
str1 = str1 + Chr(10)