高分求助!VB一些问题!一小时在线等!

来源:百度知道 编辑:UC知道 时间:2024/06/05 06:09:27
*1编写程序,实现矩阵转置,即将一个n×m的矩阵的行和列互换。例如,A矩阵及其转置矩阵B分别为:
A=1 2 3
B=1
2
3

*2设计如图3所示的界面,其中第一行为控件数组Text1,第二行为控件数组Text2,运行时输入任意内容于控件数组Text1中,单击“交换”按钮将控件数组Text1中的内容按相反的次序显示在控件数组Text2中。

*3用InputBox函数输入10个数于数组A中,输入后将这10个数显示在某文本框中,并统计正数的个数,正数的和,负数的个数,负数的和。用Print方法将结果打印在窗体上
做完后请把文件打包发我邮箱4776214@qq.com

图3 在哪啊 实现起来似乎很简单的 呵呵

1.Dim i As Integer, j As Integer, a() As Integer, n As Integer, m As Integer
n = InputBox("请输入矩阵的行数:")
m = InputBox("请输入矩阵的列数:")
ReDim a(1 To n, 1 To m)
For i = 1 To n
For j = 1 To m
a(i, j) = Int(Rnd() * 100) '给矩阵赋值,也可自己赋值
Print a(i, j);
Next j
Print
Next i
Print
For i = 1 To m '转置
For j = 1 To n
Print a(j, i);
Next j
Print
Next i

2.Private Sub Command1_Click()
Text2.Text = StrReverse(Text1.Text)
End Sub

3.dim A(9) as single,i as integer,S1 as single,S2 as single,n1 as integer,n2 as integer,R as string
for i=0 to 9
a(i)=inputbox("请输入第" & str(i+1) & "个数:")
if a(i)>0 then
n1=n1+1
s1=s1+a(i)
elseif a(i)<0 then
n2=n2+1
s2=s2+a(i)
end if
r=r & str(a(i))
next i
print "正数有" & n1 & "个。它们的和是" & str(s1)
print &quo