湖上湖
再窗体上画出text1,text2,并设置可以多行(multiline=true),一个Command1按钮用以下的算法,运行时弹出输入框, 输入n就可以了。Private Sub Command1_Click()Dim a() As StringDim str As String '用于输出的 字符串Dim n, i, j, k As Integer 'i与j用于输出n倍的每行,k用于输出n倍的每列Dim oldstr As Stringn = InputBox("input n", "input a integer", 2) '这个 n就是问题中的na = Split(Text1.Text, Chr(13))b = UBound(a) + 1 '获取text的 行数For i = 0 To b - 1For j = 1 To nstr = str & a(i) '在字符串末尾跟进一行原来的字符Next jstr = str & Chr(13) '换行Next ioldstr = strFor k = 1 To n - 1str = str & vbCrLf & oldstrNext kText2.Text = strEnd SubPrivate Sub Form_Load()Command1.Caption = "复制矩阵"End Sub