信息技術學業(yè)水平測試VB操作復習題目含答案_第1頁
信息技術學業(yè)水平測試VB操作復習題目含答案_第2頁
信息技術學業(yè)水平測試VB操作復習題目含答案_第3頁
信息技術學業(yè)水平測試VB操作復習題目含答案_第4頁
信息技術學業(yè)水平測試VB操作復習題目含答案_第5頁
已閱讀5頁,還剩57頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、信息技術學業(yè)水平測試VB操作復習題目含答案Private Sub Command1_Click() Dim h, m, s, ss As Integer ss = Val() h = ss 3600 m = (ss - h * 3600) 60 s = (ss - h * 3600) Mod 60 Label1.Caption = CStr(h) Label2.Caption = CStr(m) Label3.Caption = CStr(s)End SubVB操作一Private Sub Command1_Click() Dim x As String, y As String Dim i

2、As Integer Dim temp1 As String, temp2 As String y = For i = 1 To Len(Text1.Text) temp1 = Mid(x, i, 1) temp2 = 9 - temp1 y = y + temp2 Next i Text2.Text = yEnd SubVB操作一Private Sub Command1_Click() Dim i As Integer, a As Integer, b As Integer, c As Integer For i = 100 To 999 a = i 100 b = (i - a * 100

3、) 10 c = i Mod 10 If a 3 + b 3 + c 3 = i Then Print i Next iEnd subVB操作一Private Sub Command1_Click() Dim s(9) As Single For i = 0 To 9 s(i) = Val(InputBox(請輸入一個數(shù)) Next i For i = 9 To 0 Step -1 Print s(i) Next iEnd SubVB操作一Private Sub Command1_Click() Dim a, b, c, max As Integer a = Val(Text1.Text) b

4、 = Val(Text2.Text) c = Val(Text3.Text) If a b Then max = a Else max = b If c max Then max = c Label3.Caption = CStr(max)End SubVB操作一VB操作二打不開Private Sub Command1_Click() Dim s As Single Dim q As Single Dim a As Single Dim b As Single Dim c As Single a = Val(InputBox(請輸入邊長a的值:) b = Val(InputBox(請輸入邊長b

5、的值:) c = Val(InputBox(請輸入邊長c的值:) q = (a + b + c) / 2 s = Sqr(q * (q - a) * (q - b) * (q - c) Print sEnd SubVB操作三Private Sub Command1_Click() Dim year As Integer year = Val(InputBox(請輸入年號:) If (year Mod 4 = 0) And (year Mod 100 0) Or (year Mod 400 = 0) Then Print 是閏年 Else Print 不是閏年 End If End SubVB操

6、作三Private Sub Command1_Click() Dim a As Integer, b As Integer Dim bai As Integer, shi As Integer Dim g As Integer a = Val() bai = a 100 shi = (a - bai * 100) 10 g = a Mod 10 b = g * 100 + shi * 10 + bai = CStr(b)End SubVB操作三Private Sub Command1_Click() Dim x As Single, y As Single a = 3: b = -5 x =

7、Val(InputBox(請輸入x的值) If x = 0 Then X1 = (-b + Sqr(p) / (2 * a) X2 = (-b - Sqr(p) / (2 * a) Print X1=; X1 Print X2=; X2 Else Print 該方程無實數(shù)根 End IfEnd SubVB操作三Private Sub Command1_Click() Dim Wuyuan As Integer Dim Yiyuan As Integer Dim Wujiao As Integer For Wuyuan = 1 To 20 For Yiyuan = 1 To 100 Wujiao

8、 = 100 - Wuyuan - Yiyuan If Wuyuan * 5 + Yiyuan * 1 + Wujiao * 0.5 = 100 Then Print Wuyuan= & Wuyuan & ,Yiyuan= & Yiyuan & ,Wujiao= & Wujiao End If Next Yiyuan Next Wuyuan End SubVB操作四Private Sub Command1_Click() Dim x As Single Dim cost As Single x = Val(InputBox(請輸入蘋果公斤數(shù):) If x c) And (a + c b) An

9、d (b + c a) Then Let Text4.Text = OK Else Let Text4.Text = NO End IfEnd SubVB操作四Private Sub Command1_Click() Dim i, a, b As Integer For i = 100 To 999 a = i 100 b = (i - a * 100) 10 c = i Mod 10 If a * a * a + b * b * b + c * c * c = i Then Print CStr(i) End If Next iEnd SubVB操作五Private Sub Command1

10、_Click() Dim h, x, y As Single Let x = Val(Text1.Text) Let h = Val(Text2.Text) Let Text3.Text = yEnd SubVB操作五Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim t As Integer a = Val(Text1.Text) b = Val(Text2.Text) t = a a = b b = t Text1.Text = a Text2.Text = bEnd SubVB操作五Private Sub

11、Command1_Click() Dim n, i As Long Dim yes As Boolean Let n = Val(Text1.Text) Let yes = True For i = 2 To n 2 If n Mod i = 0 Then Let yes = False End If Next i If yes Then Let Text2.Text = yes Else Let Text2.Text = no End IfEnd SubVB操作五Private Sub Command1_Click() Dim r, s As Single r = Val() s = pi

12、* r * r T2.Text = sEnd SubVB操作五Private Sub Command1_Click()End SubVB操作六Private Sub Command1_Click() Dim a As Integer a = Val() If a Mod 2 = 0 Then Label1.Caption = 偶數(shù) Else Label1.Caption = 奇數(shù) End IfEnd SubVB操作六Private Sub Form_Click() Dim i As Integer Dim j As Integer Print For i = -3 To 3 Print Tab

13、(3); For j = 1 To 3 - Abs(i) Print *; Next Print * NextEnd SubVB操作六Private Sub Command1_Click() Dim s As Single s計算存款 Dim y As Integer y計算年份 Dim r As Single r是年利率 s = 1000 y = 0 r = Val(InputBox(輸入年利率, 數(shù)據(jù)輸入框) Do While s = 2000 y = y + 1 s = s * (1 + r) Loop Print y; 年以后,存款可以達到2000元 End SubVB操作六Priva

14、te Sub Command1_Click() Dim tz As Integer tz是桃子數(shù) Dim ts As Integer ts是天數(shù) tz = 1 For ts = 1 To 9 tz = (tz+1)* 2 Next ts Print 最初共有桃子 & tzEnd Sub倒推:第10天:1個第9天:4個第8天:10個第7天:22個。第1天:?設今天X個,剩下為Y個(明天)那么Y=X-(1/2*X+1)=1/2*X-1則X=(Y+1)*2VB操作六Private Sub Form_Load() Timer1.Interval = 1000 Label1.Caption = End

15、SubPrivate Sub Timer1_timer() Label1.Caption = TimeEnd SubVB操作七Private Sub Command1_Click() Dim x As Integer Dim s As Integer Dim i As Integer For i = 1 To 10 x = Val(InputBox(NO. & i) s = s + x Print CStr(x) Next i Print total: & s End SubVB操作七Private Sub Command1_Click() Dim w As Integer w是行李重量 Di

16、m pj As Integer pj是機票價格 Dim fy As Single w = Val(Text1.Text) pj = Val(Text2.Text) If w = 20 Then fy = 0 Else End If Text3.Text = fyEnd SubVB操作七Private Sub Command1_Click() Dim x As Single x = Val(InputBox(請輸入x的值!) If x 50 Then y = 0.8 * x Else If x a(j) Then a(0) = a(i) a(i) = a(j) a(j) =a(0) End If

17、 Next j Next i For i = 1 To 10 Print CStr(a(i) Next iEnd SubPrivate Sub Command1_Click() Dim x As Integer, y As Integer x = Val(InputBox(請輸入x的值:) If x=0 Then y = x Else y= -x End If Text1.Text = yEnd SubPrivate Sub Command1_Click() Dim x As Long For x = 67008 To 67998 Step 10 If (x Mod 67 = 0) Or (x

18、 Mod 78 = 0) Then Print x End If next xEnd SubPrivate Sub Form1_Click() Dim tz As Single, sg As Single Dim bz As Single tz = Val(InputBox(請輸入您的體重:) sg = Val(InputBox(請輸入您的體重:) bz = tz / sg 2 If bz 25 Then MsgBox (您的身材偏胖,需要加強鍛煉!) Else If Then MsgBox (您的身材偏瘦,需要補充營養(yǎng)!) Else MsgBox (您的身材真棒!) End If End I

19、fEnd SubVB操作九Private Sub Command1_Click() x = Val(Text1.Text) If x Mod 3 = 2 Then If = 3 Then If Then Print End If End If End IfEnd Sub x mod 5 x mod 7=4 xPrivate Sub Form_Click() Dim p As Integer 變量p保存人口 Dim n As Long n = 0 Do While p = p * n = Loop Print n= & CStr(n)End Sub p=14 p=20 (1+0.04) n+1P

20、rivate Sub Command1_Click() Dim s As Integer Dim a As Integer Dim b As Integer Dim k As Integer s = 0 a = 1 b = 1 For k = 1 To 10 s = s + a / b a = s = b = Next k Print sEnd Sub a = a+b s = s+b/a b = a+b Private Sub Command1_Click() Dim i As Integer Dim s As Integer i = 1 s = 0 Do While i 1500 Print

21、 N= & CStr()End Sub n n+20 n-20VB操作十Private Sub Command1_Click()Dim S1 As Single, S2 As Single Dim V1 As Single, V2 As Single Dim T As Single S1 = Val(InputBox(請輸入王曉珊家離學校的距離:) V1 = Val(InputBox(請輸入王曉珊步行速度:) V2 = Val(InputBox(請輸入李明步行速度:) T = S2 = * T Print End Sub s1/v1 v2 s2Public Function Fac(a As

22、Integer) As IntegerIf a = 1 Then Fac = Else Fac = a * (a - 1)End IfEnd FunctionPrivate Sub Command1_Click() Dim S As Integer S = Fac(3) + Fac() + Fac(7) Print S= & CStr(S)End Sub 1 Fac 5Public Function S(n As Integer) As Integer If n = 1 Then S = Else S = + S(n - 1) End IfEnd FunctionPrivate Sub Com

23、mand1_Click() Dim Sum As Integer Sum = S() Print Sum= & CStr(Sum)End Sub 1 n 100Private Sub Command1_Click() Dim L As Integer Dim chang As Integer Dim kuai As Integer Dim s As Integer Dim smax As Integer smax = 0 L = InputBox(請輸入一條鐵絲的長度:) For chang = 1 To L 2 For kuai = 1 To L 2 - chang s = If Then

24、smax = s End If Next kuai Next chang Print End Sub chang*kuai ssmax smaxPrivate Sub Command1_Click() Dim H As Single, L As Single Dim S As Single, Home As Single Home = Val(InputBox(請輸入一個起始高度:) H = Home S = 0 Do L = 0.7 * S = S + H + L H = Loop While L = Home / 1000 Print End Sub H L S第11套不做,打不開VB操作

25、十二Private Sub Command1_Click() Dim t As Single 定義變量t,值由文本框Text1讀入 t = Val() If Then Label1.Caption = 超重!不能參賽! Else Label1.Caption = 合格,可以參賽! End Sub t60 EndifPrivate Sub Command1_Click() Dim Cj As Single 定義變量Cj,值由文本框Text1讀入 Cj = Val() If Cj 60 Then Label1.Caption = 不及格 End If If Cj = 60 Then Label1.

26、Caption = 良好 End If If Cj = 85 Then Label1.Caption = 優(yōu)秀 End IfEnd Sub And Cj 85Private Sub Form_Click() Dim s As Single s變量用于存放計算結(jié)果 Dim p As Single Dim i As Integer 定義一個循環(huán)變量 給s賦初值 s = 給p賦初值 p = For i = 1 To 8 p = p * i s = Next i Print s=; CStr(s)End Sub 0 1 s+pPrivate Sub Form_Click() Dim s As Inte

27、ger 變量s存放和Dim n As Integern = 為n賦初值s = 為s賦初值Do While s 500 n = n + 1 s = Loop Text1.Text = CStr(n - 1)End Sub 0 0 s+n 0 0 =500Private Sub Form_Click()Dim s As Integer 變量s存放和 Dim n As Integers = 為s賦初值n = 為n賦初值Do n = n + 1 s = s + nLoop While s 500Text1.Text = CStr(n)End SubVB操作十三Private Sub Command1_

28、Click() Dim a As Integer Dim i As Integer a = For i = 1 To Step 1 a = Next i Text1.Text = CStr() End Sub 0 100a+i aPrivate Sub Command1_Click()Dim a As IntegerDim i As Integera = 1For i = 1 To Step 1 a = Next i Text1.Text = CStr()End Sub 7 a*i aPrivate Sub Form_Click()Dim s As Single 定義變量s為單精度型Dim i

29、 As Integer 定義循環(huán)變量 s = For i = 1 To Step 1 s = s + Next i Print s=; CStr(s)End Sub 0 100 1/iPrivate Sub Form_Click() Dim p As Single 變量p保存年產(chǎn)值 Dim n As Integer 整型變量n為所求年數(shù) n = 0 Do While p 4000 p = p * n = Loop Print n=; CStr(n)End Sub p=2000 (1+0.05) n+1Private Sub Form_Click() Dim s As Single Dim i

30、As Integer s = For i = 1 To Step 1 If i Mod 2 0 Then s = s + 1 / i Else s = End If Next i Print s=; CStr(s)End Sub 0 100 s = s - 1 / iVB操作十四Private Sub Command1_Click()Dim i As Integer 定義i為整型變量 Dim j As Integer 定義j為整型變量 For i = 1 To 6 Step 1 For j = 1 To Step 1 Print Next Print Next iEnd Sub i “”; jPrivate Sub Command1_Click() Dim a(9) As Integer Dim s As Single Dim i As Integer s = 0 Randomize For i = 0 To Step 1 a(i) = Int(Rnd * 100) Print a(i) Next i For i = 0 To 9 s = Print 這10個自然數(shù)

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論