www.zbznuf.tw > VB程序設計基礎題

VB程序設計基礎題

1. x = Val(InputBox("Input X: ")) If x < 10 Then y = Abs(x) If x 20 Then y = 3 * x + 2 Debug.Print y 2. x = Val(InputBox("Input X: ")) If x < 10 Then y = Abs(x) ElseIf x 20 Then y = 3 * x + 2 End If Debug.Print y 3. x = Val(Inp...

Private Sub Command1_Click()Dim a As Integer, b As Integer, c As Integer, d As IntegerFor a = 1 To 9 For b = 0 To 9 For c = 1 To 9 For d = 0 To 9 If Val(a & b & c & d) - Val(c & d & c) = Val(a & b & c) Then Print a & b & c & d ...

這個你沒有表述清楚,我幫你分析一下: Trim函數是去除字符串前后的空格,但中間的空格它不管,所以你輸入ab c d,執行Trim(strtext)后,結果不變,strtext的值還是ab c d,而Right(Trim(strtext), 3)之后,需要截取右面三個字符,結果就是c d咯...

解: false false false true false false false true false true X =5 -5

1.新建工程:工程1; 2.新建一下ComboBox控件:Combo1,并將屬性Style改為2; 3.新建五個Label:Label1,Label2,Label3,Label4,Label5; 4.新建兩個Text文本框:Text1,Text2 5.新建一個CommandButton按鈕:Command1; 以上的相關控件不要改名字,位...

1D 2B 3A 4C 5C 6C 7B 8B 9C 10A 這些題 都是很基礎的。

Private Sub Command1_Click() Dim i As Integer, t As Integer Dim sum As Long, totle As Integer sum = 0 For i = 1 To Text1.Text Step 2 totle = 0 For t = 1 To i Step 2 totle = totle + t Next sum = sum + totle Next MsgBox sumEnd Sub

樓主您好 這段代碼我想不難理解,注意看:For循環執行了3次,分別給a(1)、a(2)、a(3)賦值1、3、5 而b(3)、b(2)、b(1)分別與a(1)、a(2)、a(3)相等,因此它們為1、3、5 For循環的機制是:到達Next后,為循環變量加上步長,與范圍進行比較。在這段...

Private Function fun(n As Integer) As IntegerDim i As IntegerFor i = 1 To n fun = fun + i ^ 2Next iEnd Function 或 Private Function fun(n As Integer) As IntegerIf n > 0 Then fun = n ^ 2 + fun(n - 1)End Function 第二種方法使用了...

照圖,拖放好三個CommandButton控件和一個Label控件 代碼: Private Sub Form_Load() Label1.Caption = "" Command1.Caption = "歡迎詞" Command2.Caption = "祝賀詞" Command3.Caption = "退出"End SubPrivate Sub Command1_Click() Label1.Cap...

網站地圖

All rights reserved Powered by www.zbznuf.tw

copyright ©right 2010-2021。
www.zbznuf.tw內容來自網絡,如有侵犯請聯系客服。[email protected]
足彩进球彩分析