setboy
新手上路
积分 4
发帖 1
注册 2007-4-12
状态 离线
|
『楼 主』:
菜鸟求教QB程序怎么转换成VB程序?
各位大虾,由于论文需要,搞了几天头都大了都没搞好,跪求怎么把QB的程序转换成VB的程序,QB的程序清单如下:
10: read (N)
15: Dim A(N, N), M(N, N), X(N)
20: B1 = 0
25: read A1
30: If A1 = 0 Then 55
35: read A2, A3
40: A(A1, A3) = A2
45: If A2 > B1 Then B1 = A2
50: GoTo 25
55: GoSUB 630
60: For I = 1 To N
65: A(I, I) = B1
70: Next I
75: For K = I To N
80: For I = 1 To N
85: For J = 1 To N
90: If A(I, K) > A(K, J) Then 105
95: W = A(I, K)
100: GoTo 110
105: W = A(K, J)
110: If W > A(I, J) Then A(I, J) = W
115: Next J
120: Next I
125: Next K
130: GoSUB 630
135: input "K=";KK
140: If KK = 0 Then End
145: Print("K=", KK)
150: For I = 1 To N
155: For J = 1 To N
160: M(I, J) = 0
165: If A(I, J) >= KK Then M(I, J) = 1
170: Next J
175: M(I, 0) = 0
180: M(0, I) = 0
185: X(I) = 0
190: Next I
195: GoSUB 670
200: Q = 0
205: W = 0
210: For K = 1 To N
215: Q = Q + 1
220: For I = 1 To N
225: S = 0
230: If M(I, 0) > 0 Then 295
235: For J = 1 To N
240: If M(J, 0) > 0 Then 250
245: If M(I, J) > M(J, I) Then 295
250: Next J
255: X(I) = K
260: W = W + 1
265: For J = 1 To N
270: If M(J, 0) > 0 Then 285
275: If M(I, J) <> 1 Then 285
280: S = S + 1
285: Next J
290: If S > 1 Then M(0, I) = 1
295: Next I
300: For I = 1 To N
305: If M(I, 0) = 0 Then M(I, 0) = X(I)
310: Next I
315: If W = N Then 325
320: Next K
325: For K = 1 To Q
330: Print("CLASS", K, ":")
335: P = 0
340: For I = 1 To N
345: If M(I, 0) <> K Then 370
350: If M(0, I) = 1 Then 365
355: Print("{", I, "}")
360: GoTo 370
365: P = 1
370: Next I
375: If P = 0 Then 405
380: Print("{")
385: For I = 1 To N
390: If M(I, 0) = K And M(0, I) = 1 Then Print(I)
395: Next I
400: Print("}")
405: Print
410: Print("---------------------")
415: Next K
420: W = 0
425: For I = 1 To N
430: M(I, 0) = -1
435: M(0, I) = 0
440: For J = 1 To N
445: M(I, 0) = M(I, 0) + M(I, J)
450: If M(I, J) = 1 And I <> J Then M(0, I) = M(0, I + A(I, J))
455: Next J
460: If M(0, I) > W Then W = M(0, I)
465: Next I
470: W = W / 100
475: Print("*****************")
480: For I = 1 To N
485: Print("(", I, ")", M(I, 0), " ")
490: Next I
495: Print
500: Print("*****************")
505: For I = 1 To N
510: Print("(", I, ")", M(0, I) / W, " ")
515: Next I
520: Print
525: Print("*****************")
530: For I = 1 To N
535: For J = 1 To N
540: If M(I, J) * M(J, I) = 0 Then 555
545: M(I, J) = 0
550: M(J, I) = 0
555: Next J
560: Next I
565: For I = 1 To N
570: Print("(", I, ")")
575: For J = 1 To N
580: If M(I, J) = 0 Then 610
585: For K = 1 To N
590: If K = I Or K = J Then GoTo 600
595: If M(I, K) * M(K, J) = 1 Then M(I, J) = 0 : GoTo 610
600: Next K
605: Print(J)
610: Next J
615: Print
620: Next I
625: GoTo 135
630: For I = 1 To N
635: For J = 1 To N
640: Print(A(I, J))
645: Next J
650: Print
655: Next I
660: Print("*****************")
665: Return
670: For I = 1 To N
675: For J = 1 To N
680: Print(M(I, J))
685: Next J
690: Print
695: Next I
700: Print("*****************")
705: Return
1000: Data (10)
1010: DATA (1, 4, 4, 2, 4, 8, 4, 4, 1, 4, 5, 3, 5, 5, 3, 5, 3, 4, 6, 2, 8, 7, 4, 10, 8, 1,7,9, 4, 5, 9, 4, 7, 10, 3, 9)
1020: DATA (0)
看书上说VB不能用READ/DATA赋值给变量,我也不知道怎么赋值,而且在VB出现好多错误,实在是搞不定了,请各位大虾指教!在下谢了!
|
|