大一VB答案.doc_第1页
大一VB答案.doc_第2页
大一VB答案.doc_第3页
大一VB答案.doc_第4页
大一VB答案.doc_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

第五章5-15Dim xb As String, kch As StringPrivate Sub Check1_Click() kch = kch & Check1.Caption & End SubPrivate Sub Check2_Click() kch = kch & Check2.Caption & End SubPrivate Sub Check3_Click() kch = kch & Check3.Caption & End SubPrivate Sub Check4_Click() kch = kch & Check4.Caption & End SubPrivate Sub Command1_Click() Text1.Text = Text1 Text2 = 姓名: & Text1.Text & vbCrLf & _ 性别: & xb & vbCrLf & _ 班级: & Combo1.Text & vbCrLf & _ 已学课程: & kch End SubPrivate Sub Option1_Click() xb = Option1.CaptionEnd SubPrivate Sub Option2_Click() xb = Option2.CaptionEnd Sub5.7Dim a, b As StringPrivate Sub Check1_Click() a = Check1.CaptionEnd SubPrivate Sub Check2_Click() a = Check2.CaptionEnd SubPrivate Sub Command1_Click() Label1.FontSize = a Label1.FontItalic = b Label1.FontUnderline = c另解Dim a(1 To 10) As IntegerPrivate Sub Command1_Click() For i = 1 To 10 a(i) = Int(Rnd * 100) Text1 = Text1 & a(i) & Next iEnd SubPrivate Sub Command2_Click()For i = 1 To 10 Sum = Sum + a(i) Text2 = Sum / 10 Next iEnd Sub Private Sub Command3_Click() Dim max As Integer max = a(1) For i = 1 To 10 If max a(i) Then min = a(i) End If Next i Text4 = minEnd Sub Private Sub Command5_Click() 比较排序法 For i = 1 To 10 For j = i+1 To 10 If a(j) a(i) Then t = a(i) a(i) = a(j) a(j) = t End If Next j Next i For i = 1 To 10 Text5 = Text5 & a(i) & Next iEnd Sub Private Sub Command6_Click()冒泡排序法 For i = 1 To 9 For j = 1 To 10 - i If a(j) a(j + 1) Then t = a(j) a(j) = a(j + 1) a(j + 1) = t End If Next j Next i For i = 1 To 10Text6 = Text6 & a(i) & Next iEnd SubPrivate Sub Command7_Click() 选择排序法 For i = 1 To 9 k = i For j = i + 1 To 10 If a(k) a(j) Then k = j Next j If a(k) a(i) Then t = a(k) a(k) = a(i) a(i) = t End If Next i For i = 1 To 10 Text7 = Text7 & a(i) & Next iEnd Sub六乘六Private Sub Form_Click() Dim a(6, 6) As Integer For i = 1 To 6 For j = 1 To 6 a(i, j) = 2 If i = j Or i + j = 7 Then a(i, j) = 1 Next j Next i For i = 1 To 6 For j = 1 To 6 Picture1.Print Tab(6 * (j - 1); a(i, j); Next j Print Next i End SubBeepPrivate Sub Command1_Click()Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click()Timer1.Enabled = FalseEnd SubPrivate Sub Form_Load()Timer1.Enabled = FalseEnd SubPrivate Sub Timer1_Timer()Label2.Caption = Time()D = Time()If Text1 = Hour(D) And Text2 = Minute(D) ThenBeepEnd IfEnd Sub第八题Private Sub Command1_Click() Timer1.Enabled = True Timer2.Enabled = FalseEnd SubPrivate Sub Command2_Click() Timer1.Enabled = False Timer2.Enabled = FalseEnd SubPrivate Sub Form_Load() Timer1.Enabled = False Timer2.Enabled = FalseEnd SubPrivate Sub Timer1_Timer() Label1.Left = Label1.Left + 100 If Label1.Left = Form1.Width - Label1.Width Then Timer1.Enabled = False Timer2.Enabled = True End IfEnd SubPrivate Sub Timer2_Timer() Label1.Left = Label1.Left - 100 If Label1.Left = Form1.Width - Label1.Width Then i = 1 Case 1 Label1.Left = Label1.Left - 100 If Label1.Left = 0 Then i = 0 End Select End SubPrivate Sub Command1_Click()Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click()Timer1.Enabled = FalseEnd SubPrivate Sub For

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论