1樓:匿名使用者
你定義dim b(2 to 4, 1 to 3) as integer
而你以下:
for i = 1 to 3
for j = 1 to 4
b(j, i) = a(i, j)
next j
next i
b(j, i)下標j(定義為2-4),而你for j=1 to 4. 當然越標啦!
如果你沒輸入錯誤這裡的話,那就是書印刷有問題了!
2樓:匿名使用者
轉置是什麼意思我基本都忘記了。
**錯了。不知道是你敲錯了,還是書上排版錯了。
正確**
private sub command1_click()dim a(1 to 3, 1 to 4) as integerdim b(1 to 4, 1 to 3) as integerdim i as integer, j as integerdim s as string
for i = 1 to 3
for j = 1 to 4
randomize
a(i, j) = int(rnd * 90) + 10s = s & a(i, j) & " "
next j
s = s & vbcrlf
next i
label1.caption = "תöãç°µäêý×éº" & vbcrlf & s
for i = 1 to 3
for j = 1 to 4
b(j, i) = a(i, j)
next j
next i
s = ""
for i = 1 to 4
for j = 1 to 3
s = s & b(i, j) & " "
next j
s = s & vbcrlf
next i
label2.caption = "תöãºóµäêý×éº" & vbcrlf & s
end sub
3樓:匿名使用者
option base 1
dim a(4, 5) as integer, b(4, 5) as integer, c() as integer, d(4) as integer, max as integer, min as integer, maxl as integer, minl as integer
private sub command3_click()randomize
for i = 1 to 4
for j = 1 to 5
a(i, j) = 10 - int(rnd * 21) '********
d(i) = d(i) + a(i, j)next j
next i
max = d(1): maxl = 1 '**********min = d(1): minl = 1 '**********max = d(1)
min = d(1)
for i = 1 to 4
if max < d(i) then
max = d(i)
maxl = i
end if
if min > d(i) then
min = d(i)
minl = i
end if
next i
redim c(4, 5)
for i = 1 to 4
for j = 1 to 5
c(maxl, j) = a(maxl, j)a(maxl, j) = a(minl, j)a(minl, j) = c(maxl, j)picture2.print a(i, j);
next j
picture2.print
next i
end sub
另外,團idc網上有許多產品**,便宜有口碑
4樓:甜咖啡很甜
b(j, i) = a(i, j)
這句錯了,你定義dim b(2 to 4, 1 to 3) as integer
,可是你在for i = 1 to 3
for j = 1 to 4
b(j, i) = a(i, j)
next j
next i
中下標已經越界了
5樓:濮冰楓
dim b(2 to 4, 1 to 3) as integer
你定義的是b 2-4 是不是1-4啊
6樓:昔俊能
改 : dim b(1 to 4, 1 to 3) as integer
C語言陣列下標越界問題,C語言二維陣列下標越界問題
光輝歲月 首先 陣列下標是從0開始的 所以a 的下表是從0 9的,即a 10 a 9 是錯誤的。a指的是a 9 後面的那個儲存單元的的數值。其次 void fun int a,int n,int m 這個j是多餘的。 void fun int a,int n,int m 第一個括號是全形的括號!還有...
C語言下標越界問題,c語言問題,二維陣列的下標越界怎麼看?
這個跟系統有關係。如果陣列越界是否破壞了原來的函式呼叫棧,或者訪問到了不可訪問的地址,或者寫了只有讀許可權的地址,那肯定會出錯了。但是如果你的陣列的越界只是訪問到了原本就沒有被分配的記憶體,那麼就不會出錯,但是不能保證這麼下去一直不會錯。 淦海瑤 越界有危險,但是沒有辦法判斷, 於夜漆雕騫騫 第二個...
關於vb的問題!關於VB的問題
在文字框的text屬性裡設為 中國。不就ok了。剛測試過,沒問題的,你在form里加個command1,點選後,可以實現你說的效果,有問題,訊息問我。private declare sub sleep lib kernel32 byval dwmilliseconds as long private...