VB问题。输入一个自然数n,在窗体打印由1到n组成的
2个回答
展开全部
Private Sub Command1_Click()
Dim temarr(500) As String
Dim i As Integer
Dim Temstr As String
Dim j As Integer
Dim temPos As String
Temstr = InputBox("输入一个自然数", "1234")
If Temstr <> "" Then
For i = 1 To Len(Temstr)
temarr(i - 1) = Mid(Temstr, i, 1)
Next
End If
For i = 0 To Len(Temstr) - 1
For j = 1 To Len(Temstr)
If temPos = "" Then
temPos = temarr(i)
Else
temPos = temPos + temarr((i + j - 1) Mod Len(Temstr))
End If
Next
Debug.Print temPos
Print temPos
temPos = ""
Next
End Sub
Dim temarr(500) As String
Dim i As Integer
Dim Temstr As String
Dim j As Integer
Dim temPos As String
Temstr = InputBox("输入一个自然数", "1234")
If Temstr <> "" Then
For i = 1 To Len(Temstr)
temarr(i - 1) = Mid(Temstr, i, 1)
Next
End If
For i = 0 To Len(Temstr) - 1
For j = 1 To Len(Temstr)
If temPos = "" Then
temPos = temarr(i)
Else
temPos = temPos + temarr((i + j - 1) Mod Len(Temstr))
End If
Next
Debug.Print temPos
Print temPos
temPos = ""
Next
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询