![vb課后習(xí)題答案.docx_第1頁(yè)](http://file1.renrendoc.com/fileroot_temp2/2020-3/14/56ebda60-25db-4078-882f-27731a1149ac/56ebda60-25db-4078-882f-27731a1149ac1.gif)
![vb課后習(xí)題答案.docx_第2頁(yè)](http://file1.renrendoc.com/fileroot_temp2/2020-3/14/56ebda60-25db-4078-882f-27731a1149ac/56ebda60-25db-4078-882f-27731a1149ac2.gif)
![vb課后習(xí)題答案.docx_第3頁(yè)](http://file1.renrendoc.com/fileroot_temp2/2020-3/14/56ebda60-25db-4078-882f-27731a1149ac/56ebda60-25db-4078-882f-27731a1149ac3.gif)
![vb課后習(xí)題答案.docx_第4頁(yè)](http://file1.renrendoc.com/fileroot_temp2/2020-3/14/56ebda60-25db-4078-882f-27731a1149ac/56ebda60-25db-4078-882f-27731a1149ac4.gif)
![vb課后習(xí)題答案.docx_第5頁(yè)](http://file1.renrendoc.com/fileroot_temp2/2020-3/14/56ebda60-25db-4078-882f-27731a1149ac/56ebda60-25db-4078-882f-27731a1149ac5.gif)
已閱讀5頁(yè),還剩18頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
習(xí)題34 (P126)Private Sub Command1_Click() Image1.Width = Image1.Width * 1.2 Image1.Height = Image1.Height * 1.2 End SubPrivate Sub Command2_Click() Image1.Width = Image1.Width / 1.2 Image1.Height = Image1.Height / 1.2End SubPrivate Sub Command3_Click() Image1.Width = Form1.Width Image1.Height = Form1.HeightEnd SubPrivate Sub Form_Load() Image1.Left = 0 Image1.Top = 0 Image1.Picture = LoadPicture(App.Path & back.jpg)End Sub習(xí)題35 (P126)Dim mleft As LongPrivate Sub Command1_Click()Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click()Timer1.Enabled = FalseEnd SubPrivate Sub Timer1_Timer()mleft = Label1.Left + 100If mleft + Label1.Width Picture1.Width Then mleft = 0End IfLabel1.Left = mleftEnd Sub習(xí)題41 (P170)Private Sub Form_Load() Form1.Show Sum = 0 For i = 1 To 4 a = InputBox(請(qǐng)輸入數(shù)值型數(shù)據(jù)) Sum = Sum + a ave = Sum / 4 Next Print Sum; ave End Sub習(xí)題43 (P170)Private Sub Command1_Click() a = 5 b = 2.5 c = 7.8 pi = 3.14159265 y = pi * a * b / a + b * c Print y End Sub習(xí)題44 Private Sub Command1_Click() a = Val(Text1.Text) tian = a 86399 xiaoshi = (a - tian * 86400) 1439 fenzhong = (a - tian * 86400 - xiaoshi * 1440) 59 miao = a - tian * 86400 - xiaoshi * 1440 - fenzhong * 60 Text2.Text = tian & 天 & xiaoshi & 小時(shí) & fenzhong & 分鐘 & miao & 秒 End Sub習(xí)題45Private Sub Command1_Click() Const g As Single = 9.81 t = InputBox(請(qǐng)輸入t的值) v0 = InputBox(請(qǐng)輸入v0的值) s = 1 / 2 * g * t * t + v0 * t Print Format(s, 0.#) End Sub習(xí)題46Private Sub Command1_Click() Sum = 0 For i = 2 To 100 Step 2 Sum = Sum + i Next Label1.FontSize = 20 Label1.Caption = 2+4+6+100= & Sum End Sub習(xí)題47Private Sub Command1_Click() Do a = InputBox(請(qǐng)輸入三角形的第一條邊長(zhǎng)) a1 = Val(a) If a1 = -1 Then End End If b = InputBox(請(qǐng)輸入三角形的第二條邊長(zhǎng)) b1 = Val(b) If b1 = -1 Then End End If c = InputBox(請(qǐng)輸入三角形的第三條邊長(zhǎng)) c1 = Val(c) If c1 = -1 Then End End If If (a1 + b1 c1) And (a1 + c1 b1) And (b1 + c1 a1) Then s = a1 + b1 + c1 Exit Do Else Error1 = MsgBox(您輸入的數(shù)據(jù)不能組成三角形) End If Loop Label4.Caption = 您輸入的邊長(zhǎng)分別為: & a1 & , & b1 & , & c1 & & 面積為: & s End Sub習(xí)題48Private Sub Command1_Click() If Text1.Text Then a = Text1.Text Select Case a Case Is = 200 s = 0 Case Is = 400 s = (a - 200) * 0.03 Case Is = 5000 s = (400 - 200) * 0.03 + (5000 - 400) * 0.04 + (a - 5000) * 0.05 End Select Text2.Text = s Else error1 = MsgBox(請(qǐng)輸入您的收入!) End If End SubPrivate Sub Form_Load() Text2.Locked = True End SubPrivate Sub Text1_Change() If Not IsNumeric(Text1.Text) Then error1 = MsgBox(請(qǐng)輸入數(shù)字) End If End Sub習(xí)題49Private Sub Text1_Change() a = Text1.Text Select Case a Case 0 Label2.Caption = 休息 Text1.SelStart = 0 Text1.SelLength = 1 Case 1, 3 Label2.Caption = 講計(jì)算機(jī)課 Text1.SelStart = 0 Text1.SelLength = 1 Case 2, 4 Label2.Caption = 講程序設(shè)計(jì)課 Text1.SelStart = 0 Text1.SelLength = 1 Case 5 Label2.Caption = 進(jìn)修英語(yǔ) Text1.SelStart = 0 Text1.SelLength = 1 Case 6 Label2.Caption = 政治學(xué)習(xí) Text1.SelStart = 0 Text1.SelLength = 1 Case Else Error1 = MsgBox(您確認(rèn)退出程序?, 52, 確認(rèn)) If Error1 = 6 Then End Else Text1.SelStart = 0 Text1.SelLength = 1 End If End Select End Sub習(xí)題410Private Sub Command1_Click() For i = 1 To 9 Print Tab(30 - 3 * i); For j = 1 To i Print j; Next j For k = i - 1 To 1 Step -1 Print k; Next k Print Next iEnd Sub習(xí)題411Private Sub Command1_Click() For i = 1 To 30 For j = i To 30 For k = j To 30 If i * i + j * j = k * k Then Print Tab(10); i, Tab(23); j, Tab(36); k End If Next k, j, i End Sub習(xí)題412Private Sub Form_Click() Dim m As Integer, n As Integer m = CInt(Val(InputBox(請(qǐng)輸入計(jì)算范圍的初值) n = CInt(Val(InputBox(請(qǐng)輸入計(jì)算范圍的終值) For i = m To n s = 0 For j = 1 To i - 1 If i Mod j = 0 Then s = s + j End If Next j If s = i Then Print i Next iEnd Sub習(xí)題413Private Sub Form_Click()Dim a As String, c As StringDim b As Integera = InputBox(請(qǐng)輸入學(xué)生姓名)b = InputBox(請(qǐng)輸入學(xué)生成績(jī))Select Case b Case Is = 39 c = Fail Case Is = 49 c = Poor Case Is = 59 c = Fair Case Is = 79 c = Good Case Else c = Very GoodEnd SelectPrint 姓名: & aPrint 成績(jī): & bPrint 評(píng)語(yǔ): & cEnd Sub習(xí)題414Private Sub Command1_Click() Dim a As Integer a = Val(Text1.Text) If a 99 Then error1 = MsgBox(您輸入的不是兩位正整數(shù),請(qǐng)重新輸入) Else For i = 10 To 99 a1 = a 10 + (a Mod 10) * 10 i1 = i 10 + (i Mod 10) * 10 If (a + i = a1 + i1) And (a1 9) And (i1 9) Then Label2.Caption = Label2.Caption & Chr(13) & a & + & i & = & a1 & + & i1 Form1.Height = Label2.Height + Label2.Top + 1000 End If Next End IfEnd Sub習(xí)題415Dim a, b, s As DoubleDim flag, com As IntegerPrivate Sub Command1_Click() If flag = 0 Then Text1.Text = Text1.Text & Command1.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command1.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command2_Click() If flag = 0 Then Text1.Text = Text1.Text & Command2.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command2.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command3_Click() If flag = 0 Then Text1.Text = Text1.Text & Command3.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command3.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command4_Click() If flag = 0 Then Text1.Text = Text1.Text & Command4.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command4.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command5_Click() If flag = 0 Then Text1.Text = Text1.Text & Command5.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command5.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command6_Click() If flag = 0 Then Text1.Text = Text1.Text & Command6.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command6.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command7_Click() If flag = 0 Then Text1.Text = Text1.Text & Command7.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command7.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command8_Click() If flag = 0 Then Text1.Text = Text1.Text & Command8.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command8.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command9_Click() If flag = 0 Then Text1.Text = Text1.Text & Command9.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command9.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command10_Click() If flag = 0 Then Text1.Text = Text1.Text & Command10.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command10.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command11_Click() If flag = 0 Then Text1.Text = Text1.Text & Command11.Caption a = Val(Text1.Text) Else Text1.Text = flag = 0 Text1.Text = Text1.Text & Command11.Caption a = Val(Text1.Text) End If End SubPrivate Sub Command12_Click() Select Case com Case 1 a = b + a Text1.Text = a flag = 1 Case 2 a = b - a Text1.Text = a flag = 1 Case 3 a = b * a Text1.Text = a flag = 1 Case 4 a = b / a Text1.Text = a flag = 1 End Select End SubPrivate Sub Command13_Click() b = a flag = 1 com = 1 End SubPrivate Sub Command14_Click() b = a flag = 1 com = 2 End SubPrivate Sub Command15_Click() b = a flag = 1 com = 3 End SubPrivate Sub Command16_Click() b = a flag = 1 com = 4 End Sub習(xí)題51 (P196)Private Sub Form_Click()Dim a(1 To 20)For i = 1 To 20a(i) = InputBox(請(qǐng)輸入第 & i & 個(gè)元素)Next iFor i = 1 To 20Print a(i); ;Next iPrintFor i = 1 To 10 t = a(i) a(i) = a(21 - i) a(21 - i) = tNext iFor i = 1 To 20Print a(i),Next iEnd Sub習(xí)題52Private Sub Form_Click()Dim a(1 To 10, 1 To 10)For i = 1 To 10 For j = 1 To 10 If i = j Then a(i, j) = 1 ElseIf i + j = 11 Then a(i, j) = 1 Else a(i, j) = 0 End If Next jNext iFor i = 1 To 10 For j = 1 To 10 Print a(i, j); Next j PrintNext iEnd Sub習(xí)題53Private Sub Form_Click()Dim a() As Integern = InputBox(請(qǐng)輸入n)m = InputBox(請(qǐng)輸入m)Print 數(shù)組為 & n & 行 & m & 列ReDim a(n, m)For i = 1 To n For j = 1 To m a(i, j) = InputBox(請(qǐng)輸入第 & i & 行 & j & 列) Next jNext iFor i = 1 To n For j = 1 To m Print a(i, j); Next j PrintNext is = 0For i = 1 To n For j = 1 To m s = s + a(i, j) Next jNext iv = s / (n * m)Print 平均值為: & vFor i = 1 To n For j = 1 To m If a(i, j) v Then Print 元素: & a(i, j) & 行號(hào): & i & 列號(hào): & j End If Next jNext iEnd Sub習(xí)題 54Private Sub Form_Click()Dim a(1 To 50, 1 To 4) As IntegerFor i = 1 To 50 For j = 1 To 4 a(i, j) = Int(Rnd * 90 + 10) Next jNext i顯示滿足條件的行For i = 1 To 50 For j = 1 To 4 If a(i, j) 90 Then For k = 1 To 4 Print a(i, k) & ; Next k Print Exit For End If Next jNext i顯示完整數(shù)組For i = 1 To 50 For j = 1 To 4 Print a(i, j) & ; Next j PrintNext iEnd Sub習(xí)題55Private Sub Form_Click()Dim n As Integer, m As IntegerDim a() As Integern = InputBox(請(qǐng)輸入行數(shù)n)m = InputBox(請(qǐng)輸入列數(shù)m)ReDim a(1 To n, 1 To m)For i = 1 To n For j = 1 To m a(i, j) = InputBox(請(qǐng)輸入第 & i & 行 & j & 列的元素) Next jNext iFor i = 1 To n For j = 1 To m Print Format(a(i, j), 000) & ; Next j PrintNext ian_num = 0For i = 1 To n hmax = a(i, 1) lhao = 1 For j = 1 To m If a(i, j) hmax Then hmax = a(i, j) lhao = j End If Next j lmin = a(i, lhao) For k = 1 To n If a(k, lhao) av * 1.1 Then Print a(i, 1), a(i, 2), a(i, 3), 一等獎(jiǎng) ElseIf a(i, 3) av * 1.05 Then Print a(i, 1), a(i, 2), a(i, 3), 二等獎(jiǎng) End IfNext iEnd Sub習(xí)題58Private Sub Form_Click()Dim a(1 To 10, 1 To 4)For i = 1 To 10 a(i, 1) = InputBox(請(qǐng)輸入第 & i & 個(gè)學(xué)生的姓名) a(i, 2) = Val(InputBox(請(qǐng)輸入第 & i & 個(gè)學(xué)生的語(yǔ)文成績(jī)) a(i, 3) = Val(InputBox(請(qǐng)輸入第 & i & 個(gè)學(xué)生的數(shù)學(xué)成績(jī)) a(i, 4) = (a(i, 2) + a(i, 3) / 2Next iPrint 姓名, 語(yǔ)文, 數(shù)學(xué), 平均分For i = 1 To 10 For j = 1 To 4 Print a(i, j), Next j PrintNext iFor i = 10 To 2 Step -1 For j = 1 To i - 1 If a(j, 4) n Then Print 沒(méi)有找到該人 x = MsgBox(你是否還要繼續(xù)查找?, vbInformation + vbYesNo, 提問(wèn))LoopEnd Sub習(xí)題512Private Sub Form_Click()Dim a(1 To 10, 1 To 2)For i = 1 To 10 a(i, 1) = CStr(InputBox(請(qǐng)輸入運(yùn)動(dòng)員號(hào)) a(i, 2) = Val(InputBox(請(qǐng)輸入成績(jī))Next iPrint 原始的順序Print 運(yùn)動(dòng)員號(hào), 成績(jī)For i = 1 To 10 For j = 1 To 2 Print a(i, j), Next j PrintNext iFor i = 10 To 2 Step -1 For j = 1 To i - 1 If a(j, 2) a(j + 1, 2) Then t = a(j, 2) a(j, 2) = a(j + 1, 2) a(j + 1, 2) = t t = a(j, 1) a(j, 1) = a(j + 1, 1) a(j + 1, 1) = t End If Next jNext iPrint 排列的順序Print 名次, 運(yùn)動(dòng)員號(hào), 成績(jī)For i = 1 To 10 Print i, For j = 1 To 2 Print a(i, j), Next j PrintNext iEnd Sub習(xí)題513Private Sub Form_Click()Dim a(11, 11)For i = 1 To 11 a(i, 1) = 1 a(i, i) = 1Next iFor i = 3 To 11 For j = 2 To 10 a(i, j) = a(i - 1, j - 1) + a(i -
溫馨提示
- 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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- Unit 1 Knowing me,knowing you Listening and speaking 說(shuō)課稿-2023-2024學(xué)年高一英語(yǔ)外研版(2019)必修第三冊(cè)
- Unit2 What is your hobby?Lesson 7(說(shuō)課稿)-2024-2025學(xué)年人教精通版英語(yǔ)六年級(jí)上冊(cè)001
- 2025合同模板股東協(xié)議 范本
- 25《憶讀書》說(shuō)課稿-2024-2025學(xué)年五年級(jí)上冊(cè)語(yǔ)文統(tǒng)編版
- 8空氣和我們的生活 說(shuō)課稿-2024-2025學(xué)年科學(xué)三年級(jí)上冊(cè)教科版
- 遼寧新風(fēng)系統(tǒng)施工方案
- 8 網(wǎng)絡(luò)新世界說(shuō)課稿-2024-2025學(xué)年道德與法治四年級(jí)上冊(cè)統(tǒng)編版
- 高空連廊除銹刷漆施工方案
- Unit 3 Asking the way(說(shuō)課稿)-2023-2024學(xué)年譯林版(三起)英語(yǔ)五年級(jí)下冊(cè)
- 修理廠與公司車合同范例
- 2025年中國(guó)高價(jià)HPV疫苗行業(yè)競(jìng)爭(zhēng)格局分析及投資規(guī)劃研究報(bào)告
- 2025年春新北師大版物理八年級(jí)下冊(cè)課件 第七章 運(yùn)動(dòng)和力 第四節(jié) 同一直線上二力的合成
- 《肝硬化的臨床表現(xiàn)》課件
- 新增值稅法學(xué)習(xí)課件
- 飛書項(xiàng)目管理
- 醫(yī)院醫(yī)共體2025年度工作計(jì)劃
- 決戰(zhàn)朝鮮課件
- 《酶聯(lián)免疫分析技術(shù)》課件
- 鮮棗貯藏技術(shù)規(guī)程
- DB23T 3838-2024商貿(mào)行業(yè)有限空間個(gè)體防護(hù)裝備配備規(guī)范
- 2024年循環(huán)水操作工(中級(jí))職業(yè)鑒定理論考試題庫(kù)((含答案))
評(píng)論
0/150
提交評(píng)論