1樓:尤在尤存
一樓有問題.
dim a(19) as double
for i=0 to 19
a(i)=inputbox("請輸入一個數")next
dim min1 as double '記錄最小值dim min2 as integer '記錄下標min1=a(0):min2=0 '要賦初值for i = 1 to 19
if a(i) min1=a(i):min2=i end if next print "最小數是:" & min1 & " 其下標是:" & min2 2樓:悠悠周郎 dim a(19) as double for i=0 to 19 a(i)=inputbox("輸入一個數")next dim zuixiaoshu as doubledim zuixiaoshuxiabiao as integerfor i = 0 to 19 if a(i) zuixiaoshuxiabiao=i next print "最小數是:" & zuixiaoshu & " 其下標是:" & zuixiaoshuxiabiao 3樓:匿名使用者 private sub command1_click()dim a(5) as single for i = 0 to 5 a(i) = inputbox("請輸入一個數:")next i dim min as single dim minnum as integermin = a(0) for i = 0 to 5 if a(i) < min then min = a(i) minnum = i end if next i msgbox "最小的數是:" & min & " 下標是:" & minnum end sub 4樓:匿名使用者 dim a(1 to 20) dim min as double dim xiabiao as integerprivate command1_click()for i=1 to 20 a(i)=val(inputbox("輸入一個數"))next i min=a(1):xiabiao=1 for i = 2 to 20 if a(i) min=a(i) xiabiao=i next i print "最小數是:" ;min print "其下標是:" ;xiabiaoend sub vb程式設計宣告一個有10個元素的一維陣列a使用inputbox函式為所有元素賦值,將其最小元素的值及下標顯示出來 5樓:岔路程式緣 option explicit private sub form_load()form1.autoredraw = truedim a(10) as single dim i as byte for i = 1 to 10 a(i) = val(inputbox("輸入bai第du" & i & "個數 zhi", "輸入", 88)) print a(i); next print a(0) = 1 for i = 2 to 10 if a(a(0)) > a(i) then a(0) = inext print "最小 dao的元 內素是第 容a("; a(0); ")"; "="; a(a(0))end sub vb程式設計題,定義一下有20個元素的一維陣列,使用inputbox函式為陣列中的所有元素賦值,並顯示 6樓:匿名使用者 dim a(1 to 20) as integerprivate sub form_click()mx = a(1) mn = a(1) for i = 1 to 20 a(i) = inputbox("輸入一來個數自值", "輸入")if a(i) > mx then mx = a(i)if a(i) < mn then mn = a(i)next print "最大值是 " & mx & ",最小值是" & mnend sub 7樓:匿名使用者 dim a(20) dim i,j,k for i=0 to 19 a(i) = inputbox("輸入第 baidu"& i + 1 &"個資料 :zhi") if i=0 or j>a(i) thenj = a(i) end if if i=0 or k小 dao="& j &",最回 大答="& k ) 宣告一個有20個元素的一維陣列a,使用inputbox函式為其所有元素賦值,然後將其所有元素的值及其下標顯示出
35 8樓:伶伶妖 private sub form_click()dim arry(20) as integerdim str1 as string for i = 0 to 19 str1 = "請輸入第" + str(i) + "個值" arry(i) = val(inputbox(str1, "輸入值")) next i for i = 0 to 19 print "下標為"; i; "你輸入的值為"; arry(i)print next i end sub 把這個貼到你的**上,我自己寫的,要給分哦。 9樓:_星_新 **如下: private sub form_click()dim arry(20) as integerdim str1 as string for index = 1 to 20 str1 = "請輸入第" + index + "個值" arry(index - 1) = val(inputbox(str1, "輸入值")) next index for index = 0 to 19 print "下標為" + index + "你輸入的值為"+ arry(index) print next index end sub 10樓: private sub form_click()dim a(1 to 20), i as integer, j as integer for i = 1 to 20 a(i) = inputbox("") next i for j = 1 to 20 print "a(" & j & ")=" & a(j)next j end sub 宣告有一個20個元素的一 維陣列a,使用inputbox函式為其所有元素賦值,然後將其中最小元素用下標表示出來 11樓: dim a(19) as single dim i as integer dim j as integer for i=0 to 19 a(i)=val(inputbox("請輸入數字:"))next i j=0for i=1 to 19 if a(i)
print "最小元素下標為:" & j 因為題目沒有說明是整數陣列,故以上假設為單精度陣列。 vb編寫程式:一個具有10個元素的一維陣列,下標從1到10,要求用inputbox從鍵盤上輸入其元 12樓:1號阿江 解:private sub command1_click()dim a(1 to 10) as doubledim min as double for i=1 to 10 a(i)=val(inputbox("請輸入陣列元素值:"))next i for i=1 to 10 if a(i)最小的數字 專為屬:" & min end sub 13樓:逐鹿傳說 private sub command1_click()dim a(1 to 10) dim b, c b = val(inputbox(""))a(1) = b for i = 2 to 10 c = val(inputbox(""))a(i) = c if b > c then b = c next msgbox "最小:" & b end sub include using namespace std int main int p 3 a float sun 0,flag 0 for int i 0 i 3 i cout return 0 c 編寫程式,求二維陣列中的全部元素之和 指標 include iostream using names... 上帝來自地球 如下,不明白就追問吧!include void sort int a,int n int main void float juzhi printf 請輸入陣列的長度n n scanf d n printf 請輸入 d個陣列元素.n n for i 0 ia j 1 求c語言程式。輸入n... include define m 3 define n 4 int matrixsum int d m n for i m 2 i 0 i return sum int main int i,j,sum int data m n for i 0 i 不管幾維矩陣都滿足條件 參考 如下,希望能幫到你。...用C 編寫程式,計算二維陣列中所有元素的平均值 用
用函式傳遞一維陣列的知識編寫程式,求n個數的最大值 最小值 平均值 並排序。謝謝
用c語言程式設計求m n二維陣列的周邊元素之和並用函