(vb程序设计)求代码:用两重循环在窗体上显示如右图结果。 【提示】两种方法解该题? 50
用两重循环在窗体上显示如下图结果。【提示】用两种方法解该题:方法一:利用数值实现,就是将各列列号通过运算连接起来。方法二:利用Mid函数取字符串子串来实现,即从字符串中不...
用两重循环在窗体上显示如下图结果。
【提示】用两种方法解该题:
方法一:利用数值实现,就是将各列列号通过运算连接起来。
方法二:利用Mid函数取字符串子串来实现,即从字符串中不断取所需的子字符串而得。还要注意行号与负号的关系。 展开
【提示】用两种方法解该题:
方法一:利用数值实现,就是将各列列号通过运算连接起来。
方法二:利用Mid函数取字符串子串来实现,即从字符串中不断取所需的子字符串而得。还要注意行号与负号的关系。 展开
1个回答
展开全部
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim n As Long
For i = 1 To 6
For j = 1 To i
n = n * 10 + j
If i Mod 2 <> 0 Then
Picture1.Print n;
Else
Picture1.Print -n;
End If
Next
n = 0
Picture1.Print
Next
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer, s As String
s = "123456"
For i = 1 To 6
For j = 1 To i
If i Mod 2 <> 0 Then
Picture1.Print " " & Mid(s, 1, j); " ";
Else
Picture1.Print "-" & Mid(s, 1, j); " ";
End If
Next
Picture1.Print
Next
End Sub
Dim i As Integer, j As Integer
Dim n As Long
For i = 1 To 6
For j = 1 To i
n = n * 10 + j
If i Mod 2 <> 0 Then
Picture1.Print n;
Else
Picture1.Print -n;
End If
Next
n = 0
Picture1.Print
Next
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer, s As String
s = "123456"
For i = 1 To 6
For j = 1 To i
If i Mod 2 <> 0 Then
Picture1.Print " " & Mid(s, 1, j); " ";
Else
Picture1.Print "-" & Mid(s, 1, j); " ";
End If
Next
Picture1.Print
Next
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询