[VB6 ] 聯集與交集的運算

看板Visual_Basic作者 (單眼皮)時間18年前 (2007/05/09 16:56), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/4 (看更多)
我要寫一個聯集減交集的運算式,但是每次都只出先現最大的值,不知是哪裡出錯,可 以幫我看一下那裡出問題,或是可以更精簡的!!謝謝 Dim n1(15) As Integer Dim n2(15) As Integer Dim n4(15) As Integer Dim k(15) As Integer Dim q(15) As Integer '聯集減交集 For i = 0 To 15 n1(i) = Val(Text1(i).Text) n2(i) = Val(Text2(i).Text) n4(i) = Val(Text4(i).Text) '取聯集 If n1(i) > n2(i) And n1(i) > n4(i) Then k(i) = n1(i) ElseIf n2(i) > n1(i) And n2(i) > n4(i) Then k(i) = n2(i) ElseIf n4(i) > n1(i) And n4(i) > n2(i) Then k(i) = n4(i) '取交集 ElseIf n1(i) < n2(i) And n1(i) < n4(i) Then q(i) = n1(i) ElseIf n2(i) < n1(i) And n2(i) < n4(i) Then q(i) = n2(i) ElseIf n4(i) < n1(i) And n4(i) < n1(i) Then q(i) = n4(i) End If Text3(i).Text = k(i) - q(i) Next i -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.126.20.39
文章代碼(AID): #16GOoYAT (Visual_Basic)
文章代碼(AID): #16GOoYAT (Visual_Basic)