有關VB6 for next語句的問題急急急急急急急急急急好的加分

時間 2021-08-30 10:59:13

1樓:常山大寶

下面是command1單擊事件**。。

private sub command1_click()on error goto err

dim a as integer

a = me.text1

me.label4.caption = 0for i = 1 to text2

me.label4.caption = me.label4.caption + a + a / 2

a = a / 2

next

me.label6.caption = aexit sub

err:

msgbox err.descriptionend sub

2樓:匿名使用者

過程分析:

1、落地-彈起是一個週期。

2、落地前高度是該週期的初始引數h,運動距離是s = 1.5h,s是該週期的運動結果。

3、h是變數,需要迭代替換,s則需要累加。

程式實現如下:

private sub command1_click()dim h as double

dim s as double

dim n as integer

'初始化變數

h = 0

n = 0

s = 0

'使用文字前做合法性判斷

if isnumeric(text1.text) then h = text1.text

if isnumeric(text2.text) and cstr(cint(text2.text)) = text2.

text then n = cint(text2.text)

if h > 0 and n > 0 thendim i as integer

for i = 1 to n

s = s + 1.5 * h

h = h / 2

next

label4.caption = s

label6.caption = h

end if

end sub

3樓:匿名使用者

先列好數學公式,再把公式轉換成**即可,關鍵在公式

關於for next語句的問題,VB的for next語句問題

濤濤和俊俊 n 0for i 1 to 3 for j i to1 step 1 n n 1 next j,i print n i j 比如這個題目的i,j結束迴圈時是3,1 是在這個基礎上再 1既退出迴圈後是4,0,確實是要在迴圈過後加1,因為只有條件為假的時候,才退出迴圈 第二個問題回答 迴圈過...

關於vb的if語句的寫法,關於VB的IF語句的寫法

根據表示式的值有條件地執行一組語句。語法 if condition then statements else elsestatements 或者,可以使用塊形式的語法 if condition then statements elseif condition n then elseifstateme...

vb中的optioneplicit語句有什麼作用

option explicit 語句 用於在檔案級強制對該檔案中的所有變數進行顯式宣告。option explicit 各部分說明 on 可選。啟用 option explicit 檢查。如果在 option explicit 語句後沒有指定 on 或 off,則預設為 on。off可選。禁用 op...