一道有關vb程式設計的題目,一道比較簡單的VB程式題目,只需要程式碼即可

時間 2021-05-07 19:59:54

1樓:火星飛人

private sub form_load()

show

label1.autosize = true

label1.caption = str(time())

label1.top = val(form1.height) / 2 - val(label1.height) / 2

label1.left = val(form1.width) / 2 - val(label1.width) / 2

command1.caption = "放大"

end sub

private sub command1_click()

label1.fontsize = val(label1.fontsize) * 3

label1.caption = str(time())

label1.top = val(form1.height) / 2 - val(label1.height) / 2

label1.left = val(form1.width) / 2 - val(label1.width) / 2

end sub

2樓:

label1.caption = now

now就是當前系統時間

一道比較簡單的vb程式題目,只需要**即可 100

3樓:別在回來找俄

1.用vb程式設計序設計一個簡易的計算器

**:dim num_1, num2, flagprivate sub command1_click(index as integer)  select case index    case 0 to 9      label1.caption = label1.

caption + cstr(command1(index).caption)    case 10      label1.caption = label1.

caption + "."    case 11 to 14      num_1 = val(label1.caption)      label1.

caption = ""      flag = index    case 15      num_2 = val(label1.caption)      label1.caption = ""      if command1(flag).

caption = "+" then        label1.caption = num_1 + num_2      elseif command1(flag).caption = "-" then        label1.

caption = num_1 - num_2      elseif command1(flag).caption = "*" then        label1.caption = num_1 * num_2      else        label1.

caption = num_1 / num_2      end if    case 16      num_1 = 0      num_2 = 0      label1.caption = ""  end selectend sub private sub form_load()  me.autoredraw = true  for i = 0 to 9    command1(i).

caption = i  next iend sub

窗體介面設定:

在窗體上建立控制元件陣列command1(0),command1(1),command1(2),……,command1(16),其captint屬性分別設定為0,1,2,3,4,5,6,7,8,9,.,+,-,*,/,=,c

2.用vb程式設計序實現十進位制與二進位制之間的相互轉化**:private sub command1_click()  text3.

text = ""  text4.text = "0."  n = val(text1.

text)  do while n > 0    text3.text = cstr(n mod 2) + text3.text    n = n \ 2  loop  n = val(text2.

text)  do while n > 0    text4.text = text4.text + cstr(fix(2 * n))    n = 2 * n - fix(2 * n)  loopend sub private sub command2_click()  dim s1, s2  text1.

text = ""  text2.text = ""  for i = 1 to len(text3.text)    s1 = s1 + val(mid(text3.

text, i, 1)) * 2 ^ (len(text3.text) - i)  next i  text1.text = s1  for i = 3 to len(text4.

text)    s2 = s2 + val(mid(text4.text, i, 1)) * 2 ^ (-(i - 2))  next i  text2.text = "0" + cstr(s2)end sub private sub command3_click()  text1.

text = ""  text2.text = ""  text3.text = ""  text4.

text = ""end sub private sub form_load()  me.autoredraw = trueend sub private sub text1_keypress(keyascii as integer)  if (keyascii < 48 or keyascii > 57) and keyascii <> 8 then    keyascii = 0    beep  end ifend sub private sub text2_keypress(keyascii as integer)  if (keyascii < 48 or keyascii > 57) and keyascii <> 8 and keyascii <> 46 then    keyascii = 0    beep  end ifend sub private sub text3_keypress(keyascii as integer)  if (keyascii < 48 or keyascii > 49) and keyascii <> 8 then    keyascii = 0    beep  end ifend sub private sub text4_keypress(keyascii as integer)  if (keyascii < 48 or keyascii > 49) and keyascii <> 8 and keyascii <> 46 then    keyascii = 0    beep  end ifend sub

執行介面:

求解一道高中VB題目,一道vb題目求解。

private sub form click dim i as integer dim s as integer s 1 for i 1 to 9 s s 1 2 next i print s s end sub 是1534個 迴圈9次。因為第十天已經剩下1個 就沒再吃了 樓上那位 han44229...

一道c語言程式設計題目

c,靜態變數在整個程式執行過程中都存在。首先呼叫fun a fun d 中的fun d 這裡的d是外部變數d即值為1,所以在被呼叫函式裡p值就為1 進入函式fun後外部變數d被遮蔽,靜態變數d起作用,d p使d變為6,所以第一個輸出的數是6 然後函式fun返回數字6,這樣a fun d 為9,再次呼...

急求這一道程式設計題目用c語言,急求這一道程式設計題目,用C語言

我寫了一個你看咱樣行不 include include main char b 數學 物理 外語 政治 體育 人數 system color a printf 原始資訊如下 n printf 數學 d n a 0 printf 物理 d n a 1 printf 外語 d n a 2 printf ...