1樓:匿名使用者
我來試試
a()b()
dim i as integer ,j as integerdim x as boolean
for i = 0 to ubound(a)x=true
for j = 0 to ubound(b)if a(i) = b (j) thenx=false
exit for
endif
next
if x then list1.additem a(i)next
for i = 0 to ubound(b)x=true
for j = 0 to ubound(a)if b(i) = a (j) thenx=false
exit for
endif
next
if x then list1.additem b(i)next
2樓:匿名使用者
'樓上的無法解決2,與22判斷出錯的問題。
'在窗體上加入控制元件list1,command1,複製下面**,執行即可。
option explicit
private sub command1_click()
dim s1 as string, s2 as string, i as integer, a() as string
s1 = "2,3,4,6" '根據實際情況按此格式修改
s2 = "2,6,7,8" '根據實際情況按此格式修改
s1 = "," & s1 & ",": s2 = "," & s2 & ","
with list1
.clear
a = split(s1, ",")
for i = 1 to ubound(a) - 1
if instr(s2, "," & a(i) & ",") = 0 then .additem a(i)
next
a = split(s2, ",")
for i = 1 to ubound(a) - 1
if instr(s1, "," & a(i) & ",") = 0 then .additem a(i)
next
end with
end sub
3樓:匿名使用者
dim cmp() as integer
sub comparenumber()
redim preserve cmp(0)
dim arr1(3) as integer,arr2(3) as integer
dim i as integer,f as string
arr1(0) = 2:arr1(1) = 3:arr1(2) = 4:arr1(3) = 6
arr2(0) = 2:arr2(1) = 6:arr2(2) = 7:arr2(3) = 8
for i = 0 to ubound(arr2):f = f & trim(str(arr2(i))):next i
for i = 0 to ubound(arr1)
if len(replace(f,trim(str(arr1(i))),"")) next i for i = 0 to ubound(arr1):f = f & trim(str(arr1(i))):next i for i = 0 to ubound(arr2) if len(replace(f,trim(str(arr2(i))),"")) next i '輸出for i = 1 to ubound(cmp):list1.additem trim(str(cmp(i))):next i end sub function isrepeat(n as integer) isrepeat = false:dim i as integer for i = 0 to ubound(cmp) if cmp(i)=n then isrepeat = true:exit for next i end function ------- 主程式呼叫:comparenumber() 如private sub command1_click() comparenumber end sub cmp()為全域性變數 沒有測試 如有錯誤請指出 主要思路:先把陣列歸併在一起,然後從另一個陣列中依次讀出一個數字,並在原字串中替換那個數字為空白。如果存在那個數字,那麼就會被替換掉,則字串總長減少;否則字串總長不會減少;當然這裡已經有了重複判斷,用instr判斷也行 4樓: on error resume next dim mygroupa as string, mygroupb as string, mygroupaarr, mygroupbarr, i as integer, j as integer mygroupa = "2,3,4,6" 'a組資料,各數間用英文逗號「,」分開 mygroupb = "2,6,7,8," 'b組資料,各數間用英文逗號「,」分開 mygroupaarr = split(mygroupa, ",") mygroupbarr = split(mygroupb, ",") if ubound(mygroupaarr) > ubound(mygroupbarr) then j = ubound(mygroupaarr) else j = ubound(mygroupbarr) for i = 0 to j if instr(1, mygroupb, mygroupaarr(i)) = 0 then list1.additem mygroupaarr(i) if instr(1, mygroupa, mygroupbarr(i)) = 0 then list1.additem mygroupbarr(i) next 5樓:匿名使用者 private sub command_click()dim a(4) as integer dim b(4) as integer dim c(8) as integer dim i, k a(0) = 2 a(1) = 3 a(2) = 4 a(3) = 6 b(0) = 2 b(1) = 6 '2,6,7,8 b(2) = 7 b(3) = 8 dim s as string k = 0 s = "" for i = 0 to ubound(a)if syesorno(a(i), b()) = false then c(k) = a(i) k = k + 1 end if next i for i = 0 to ubound(b)if syesorno(b(i), a()) = false then c(k) = b(i) k = k + 1 end if next i for i = 0 to ubound(c)if c(i) > 0 then s = s & c(i) & chr(13) & chr(10)end if next i msgbox s end sub private function syesorno(byval s1 as long, byref x() as integer) as boolean dim i as long syesorno = false for i = 0 to ubound(x)if s1 = x(i) then syesorno = true end if next i end function 6樓:匿名使用者 這個是小兒科 但是他們的程式很複雜 我看得頭疼 你要是還不明白那就hi我吧 我用簡單語言寫 vb程式設計輸入兩組數字,列出兩組數字中互不重複的數字?求程式! 7樓:匿名使用者 用字典就好了。 思路是:一次讀取2組數字,然後迴圈,第一次出現的加到字典裡面,數量為1,再次出現再+1,最後迴圈字典,判斷value =1 即可。 用vb求兩個數之和,怎麼編寫**? 8樓:斬天及 雙擊那個「計算」按鈕,寫下如下**(如果那3個文字框是預設名稱的話): text3.text = cdbl(text1.text) + cdbl(text2.text) 9樓:此使用者暫中木馬 text2.text = val(text1.text) + val(text3.text) 要不text1.text = val(text2.text) + val(text3.text) 10樓:有手藝的農民 private sub command1_click()text3.text = val(text1.text) + val(text2.text) end sub 簡便一點就是這樣,如果還要複雜一點的話,command1應該判斷text1和text2是不是空白,是不是填入的是數字。 11樓:網海1書生 1、如果你的水平是剛剛入門的,那麼你至少必須提供你窗體上各個控制元件的名稱,比如三個文字框、兩個按鈕分別是什麼名(就是類似text1、command1這樣的名稱),這樣我們根據這些就可以寫出完整無誤的**,你複製過去就可以吃了,完全傻瓜化; 2、如果你已經入門,但還沒到客廳,只是站在門廊裡的,那麼你應該有一定的**修改能力。上面幾位大神的**本身是沒錯的,只是可能跟你的控制元件名稱不符,所以直接執行是會出錯的,你只要自己修改一下即可; 3、如果你是還沒有入門的門外漢,或者是已經是坐在客廳沙發偷笑的老鳥,那麼我們會認為你是故意來涮我們,故意尋開心的,儘早滾蛋! 4、追問的時候不要只說「錯」好麼?說說錯誤的詳細情況,可能使我們找出問題的原因。雖然知道你是手機提問的,但多打幾個字也不是很難的事情對麼? 用vb怎樣生成10個不重複的(1到10)隨機數? 12樓:匿名使用者 vb生成10個不重複的隨機數**:private sub command1_click()dim a(9) as integer for i = 0 to 9 goto way1 end if next p end if print a(i) next i end sub 13樓: private sub command1_click()dim a(9) as integer for i = 0 to 9 way1: randomize a(i) = int(rnd() * 10) + 1if i > 1 then for p = 0 to i - 1 if a(p) = a(i) then 『與前面的對比,如果有重複,重新隨機 goto way1 end if next p end if print a(i) 』列印 next i end sub 最好用實際頻數,執行一下這個命令 tabi 30 18 18 14 你能得到 col row 1 2 total 1 30 18 48 2 18 14 32 total 48 32 80 fisher s exact 0.645 1 sided fisher s exact 0.371 卡方檢驗用t... 引入另外一列隨機數列a隨機列b隨機列c是列a和列b的線性疊加er,係數是多少需要數學好的人來算算當然如果你要求不高的話,找個格子寫上 correl a a,c c 多try幾把也就試出來了c大約在a 1.7b左右求採納 付費內容限時免費檢視 回答親親,您好,很高興為您解答,生成使用md5加密的32位... 把這兩組資料選中,插入,圖表,x,y,散點圖,確定。右鍵點圖,新增趨勢線。2003版 選擇趨勢線的型別 線性 指數型 顯示方程2007版 再右鍵點趨勢線,設定,如上。 廈門侯 要對兩列資料進行統計,以獲得兩列資料間的迴歸方程啊。比如你的資料為兩列,a列和b列,其中,a列為自變數x,b列為應變數y。選...如何用stata的卡方檢驗來測試兩組比率是否存在顯著差異
如何用excel生成兩組具有關聯性的隨機資料
如何利用excel找到兩組資料之間的函式對應關係