急:用VB求解数据结构中的问题

来源:百度知道 编辑:UC知道 时间:2024/06/01 17:46:32
1.对任给的n(n<=10)个实数,请利用顺序表(即数组方式)进行存放,并对自行指定的第k(1<=k<=n)个数据进行:(1)插入一个数据的操作,并显示其运算后结果;(2)删除一个数据的操作,并显示其运算后结果。
2.编程实现顺序栈的压入和弹出;
3.编程实现队的入队和出队;
4.用三元数组表示并输出转置矩阵,要求为1-9之内的数,矩阵为10*10,10%的非零矩阵。

老师布置的作业,我实在不会编程,VB也是2年前学的了~ 希望高手能帮忙,实在不行用其他计算机语言也可以!

Private Sub Command1_Click()
Text1.Text = ""
Open App.Path & "\in.txt" For Input As #1
j = 1
x = 1
cd = 1
Do Until EOF(1)

Line Input #1, strline

Do Until (cd = 0) Or (strline = " ")
x = InStr(strline, " ")
If (x = 0) Then
temp1 = strline
temp2 = temp1
strline = ""
End If
If (x = 1) Then
temp1 = strline
y = InStr(LTrim(temp1), " ")
temp2 = Left(LTrim(temp1), y - 1)
strline = Mid(LTrim(temp1), y)
End If
If (x > 1) Then
temp1 = strline
temp2 = Left(temp, x - 1)
strline = Mid(temp1, y)
End If
s(j) = CInt(temp2)
cd = Len(strline)