




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、信息技術(shù)學(xué)業(yè)水平測(cè)試VB操作復(fù)習(xí)題目含答案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(請(qǐng)輸入一個(gè)數(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(請(qǐng)輸入邊長(zhǎng)a的值:) b = Val(InputBox(請(qǐng)輸入邊長(zhǎng)b
5、的值:) c = Val(InputBox(請(qǐng)輸入邊長(zhǎng)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(請(qǐng)輸入年號(hào):) 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(請(qǐng)輸入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 該方程無(wú)實(shí)數(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(請(qǐng)輸入蘋果公斤數(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計(jì)算存款 Dim y As Integer y計(jì)算年份 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; 年以后,存款可以達(dá)到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個(gè)第9天:4個(gè)第8天:10個(gè)第7天:22個(gè)。第1天:?設(shè)今天X個(gè),剩下為Y個(gè)(明天)那么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是機(jī)票價(jià)格 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(請(qǐng)輸入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(請(qǐng)輸入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(請(qǐng)輸入您的體重:) sg = Val(InputBox(請(qǐng)輸入您的體重:) bz = tz / sg 2 If bz 25 Then MsgBox (您的身材偏胖,需要加強(qiáng)鍛煉!) Else If Then MsgBox (您的身材偏瘦,需要補(bǔ)充營(yíng)養(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(請(qǐng)輸入王曉珊家離學(xué)校的距離:) V1 = Val(InputBox(請(qǐng)輸入王曉珊步行速度:) V2 = Val(InputBox(請(qǐng)輸入李明步行速度:) 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(請(qǐng)輸入一條鐵絲的長(zhǎng)度:) 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(請(qǐng)輸入一個(gè)起始高度:) 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變量用于存放計(jì)算結(jié)果 Dim p As Single Dim i As Integer 定義一個(gè)循環(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個(gè)自然數(shù)
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度二手車寄售代理服務(wù)合同
- 2025年度吊車租賃與施工現(xiàn)場(chǎng)管理服務(wù)協(xié)議
- 2025年車貸居間服務(wù)收費(fèi)標(biāo)準(zhǔn)合同范本
- 建立適應(yīng)性強(qiáng)的財(cái)務(wù)體系計(jì)劃
- 學(xué)生領(lǐng)導(dǎo)力培養(yǎng)課程計(jì)劃
- 教學(xué)工作創(chuàng)新方向計(jì)劃
- 年度戰(zhàn)略性談判的技巧分享計(jì)劃
- 市場(chǎng)調(diào)研與分析工作安排計(jì)劃
- 特色課程開發(fā)與實(shí)施方案計(jì)劃
- 高危作業(yè)的安全保障措施優(yōu)化計(jì)劃
- 1.2《友邦驚詫論》教學(xué)設(shè)計(jì)-【中職專用】高二語(yǔ)文同步講堂(高教版2024·拓展模塊上冊(cè))
- 《紡織服裝材料》課件-0緒論
- 盤扣式卸料平臺(tái)施工方案
- 繪本故事在小學(xué)道德與法治課堂中的有效教學(xué)策略分析
- 2023年江蘇省鹽城市中考數(shù)學(xué)試卷及答案
- 胃癌影像診斷(共42張)
- 2024新高考英語(yǔ)1卷試題及答案(含聽力原文)
- G -B- 43068-2023 煤礦用跑車防護(hù)裝置安全技術(shù)要求(正式版)
- 劍橋KET詞匯表(中英對(duì)照)
- 2024年湖南高速鐵路職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫(kù)附答案
- 2024年4月浙江省00015英語(yǔ)二試題及答案含評(píng)分參考
評(píng)論
0/150
提交評(píng)論