3第三讲习题答案 -

求个稳定的时时彩计划 www.23wccr.cn

cj1 = Val(Text1.Text) cj2 = Val(Text2.Text) cj3 = Val(Text3.Text)

avecj = (cj1 + cj2 + cj3) / 3

If (avecj > 95) Or (cj1 = 100 And cj2 = 100 And cj3 >= 80) Or (cj1 = 100 And cj3 = 100 And cj2 >= 80) Or (cj3 = 100 And cj2 = 100 And cj1 >= 80) Then

Text4.Text = \一等奖\

ElseIf (avecj > 90) Or (cj1 = 100 And cj2 >= 75 And cj3 >= 75) Or (cj1 = 100 And cj3 >= 75 And cj2 >= 75) Or (cj3 = 100 And cj2 >= 75 And cj1 >= 75) Then

Text4.Text = \二等奖\

ElseIf (cj1 >= 70 And cj2 >= 70 And cj3 >= 70) Then Text4.Text = \三等奖\ End If End Sub

Private Sub Form_Load() Text1.Text = \ Text2.Text = \ Text3.Text = \ Text4.Text = \End Sub

10. 从键盘上输入10个无序数,去掉一个最大数和最小数,然后求其平均值。 Private Sub Command1_Click() Dim i As Integer Dim max As Integer Dim min As Integer Dim ave As Single Dim sum As Integer Dim a(10) As Integer

For i = 1 To 10

a(i) = InputBox(\请输入第\个数\ Next

sum = a(1) max = a(1) min = a(1) For i = 2 To 10

If max < a(i) Then max = a(i) If min > a(i) Then min = a(i) sum = sum + a(i)

6

Next i

sum = sum - max - min ave = sum / 8

MsgBox \平均值为:\ End Sub

11. 求下面第n个Fibonacel数,Fibonacel数定义如下:

a) f(0)=0 b) f(1)=1

c) f(n)=f(n-1)+f(n-2) n>=2 Private Sub Command1_Click() Dim f() As Integer Dim i As Integer Dim n As Integer

n = InputBox(\请输入要输出多少项\

ReDim f(n) f(0) = 0 f(1) = 1

For i = 2 To n - 1

f(i) = f(i - 1) + f(i - 2) Next i

For i = 0 To n - 1 Print f(i); \ \

If (i + 1) Mod 5 = 0 Then Print Next i End Sub

12. 100匹马驮100?;?,大马一匹驮3担,中马一匹驮2担,小 马2匹驮一担,

编程计算大、中、小马的数量。 Private Sub Command1_Click() Dim bigh As Integer Dim midh As Integer Dim smallh As Integer

For bigh = 1 To 33

For midh = 1 To 50

smallh = 100 - bigh - midh

If bigh * 3 + midh * 2 + smallh * 0.5 = 100 Then Print bigh, midh, smallh

7

End If Next midh Next bigh End Sub

13. 有36块砖,共36人搬,男人一次搬4砖,女人一次搬3砖,小孩一次两人

搬一块,求一次搬完且不可以空手,问男人,女人和小孩各需多少人? Private Sub Command1_Click() Dim man As Integer Dim woman As Integer Dim child As Integer

For man = 1 To 9

For woman = 1 To 12

child = 36 - man - woman

If man * 4 + woman * 3 + child * 0.5 = 36 Then Print man, woman, child End If Next woman Next man End Sub

14. 编写猜数游戏程序,由计算机自动产生一个1,100]的随机整数,用户输入猜

数后由计算机自动比较,并通过消息框提示太大了或太小了等信息,共有5次猜数机会,如果在规定的次数内猜中,则消息框中显示猜中了等信息,如果5次都不对,则显示猜数失败等信息。 Private Sub Command1_Click() Dim computer As Integer Dim user As Integer Dim i As Integer

Randomize

computer = Int(Rnd * 100) + 1 For i = 1 To 5

user = InputBox(\请输入你猜的数\ If user = computer Then MsgBox \你猜对了\ Exit For Else

If user > computer Then

MsgBox \猜错了,太大了,还有\次机会\ Else

MsgBox \猜错了,太小了,还有\次机会\

8

End If End If Next i

If i > 5 Then

MsgBox \猜数失败\ End If End Sub

15. 编程完成,从一堆一分,二分,五分的硬币中取出20枚,使其总值为60分,

要求输出有多少种取法,及每一种取法的一分,二分,五分的个数. Private Sub Command1_Click() Dim yf As Integer '表示一分 Dim ef As Integer '表示二分 Dim wf As Integer '表示五分 Dim coun As Integer

coun = 0 '计数器

Print \一分\二分\五分\ For yf = 1 To 20 For ef = 1 To 20 wf = 20 - yf - ef

If yf + ef * 2 + wf * 5 = 60 Then Print yf, ef, wf coun = coun + 1 End If Next ef Next yf

Print \一共有\种取法\End Sub

16. 随机生成20个100以内的正整数,将其中的奇数和偶数分两行显示在窗体

上。

Private Sub Command1_Click() Dim a(20) As Integer Dim i As Integer

Randomize For i = 1 To 20

a(i) = Int(Rnd * 100) Next i

'处理奇数 For i = 1 To 20

If a(i) Mod 2 = 1 Then Print a(i); \ \

9

Next i Print

'处理偶数 For i = 1 To 20

If a(i) Mod 2 = 0 Then Print a(i); \ \ Next i End Sub

17. 产生10个100以内的随机整数,将它们从大到小排序输出 Private Sub Command1_Click() Dim i As Integer, j As Integer Dim a(10) As Integer Dim pos As Integer Dim temp As Integer

Randomize

For i = 1 To 10

a(i) = Int(Rnd * 100) '生成10个随机数,并输出 Print a(i); \ \ Next i Print

For i = 1 To 9 pos = i

For j = i + 1 To 10

If a(pos) < a(j) Then pos = j '找到最大数的位置,记录在pos中 Next j

If pos <> i Then '交换最大数和当前第一个数的位置 temp = a(i) a(i) = a(pos) a(pos) = temp End If Next i

For i = 1 To 10

Print a(i); \ \ '将结果输出显示 Next i End Sub

10

最近浏览

  • 3第三讲习题答案 -
  • 最新教科版小学科学三年级下册《蚕的生长变化》公开课教学设计2
  • 2007年报关员考试模拟试题及答案3 -
  • 度米作文汇编之2015年北京高考英语作文精选" href=mlhd_3fj2b8iv4z1ujtp7zqyg25ui718xn3018xh_1.html>度米作文汇编之2015年北京高考英语作文精选" target="_blank" data-docid="6642178150" data-edocid="57f143da76232f60ddccda38376baf1ffd4fe375" class="log-xsend tiaoquan act-xsend" data-index='9' data-logxsend='[1, 100055, {"score_mode": "3", "price_data": "28", "doc_id": "6642178150", "index":"10", "page_number":"", "small_flow_flag": ""}]'>度米作文汇编之2015年北京高考英语作文精选
  • 度米作文汇编之简单英语作文HowtolearnEnglishwel..." href=mlhd_28w6620zqk2xc786b4a94zk8m0hvkq00ryb_1.html>度米作文汇编之简单英语作文HowtolearnEnglishwell" target="_blank" data-docid="6432314042" data-edocid="3996de33f6ec4afe04a1b0717fd5360cba1a8d83" class="log-xsend tiaoquan act-xsend" data-index='8' data-logxsend='[1, 100055, {"score_mode": "3", "price_data": "28", "doc_id": "6432314042", "index":"9", "page_number":"", "small_flow_flag": ""}]'>度米作文汇编之简单英语作文HowtolearnEnglishwel...
  • 一年级学生评语大全精品名师资料" href=mlhd_2gspk9rv1123x6i11fyp2nsft0iv0l00r5f_1.html>一年级学生评语大全精品名师资料" target="_blank" data-docid="6642243131" data-edocid="3f3758fa7ed5360cba1aa8114431b90d6d858973" class="log-xsend tiaoquan act-xsend" data-index='7' data-logxsend='[1, 100055, {"score_mode": "3", "price_data": "10", "doc_id": "6642243131", "index":"8", "page_number":"", "small_flow_flag": ""}]'>一年级学生评语大全精品名师资料
  • 度米作文汇编之五年级英语作文一项通知" href=mlhd_9d5lr784k24bptb11x4w7g2499ip7300mob_1.html>度米作文汇编之五年级英语作文一项通知" target="_blank" data-docid="6642274037" data-edocid="f0069fb930126edb6f1aff00bed5b9f3f90f72cb" class="log-xsend tiaoquan act-xsend" data-index='6' data-logxsend='[1, 100055, {"score_mode": "3", "price_data": "28", "doc_id": "6642274037", "index":"7", "page_number":"", "small_flow_flag": ""}]'>度米作文汇编之五年级英语作文一项通知
  • 度米作文汇编之初中英语作文模板教育的重要性" href=mlhd_88bal2x9fh7u3cm9b9nu86wqu5roxb0035w_1.html>度米作文汇编之初中英语作文模板教育的重要性" target="_blank" data-docid="6432413270" data-edocid="d2f32d4aeffdc8d376eeaeaad1f34693dbef1004" class="log-xsend tiaoquan act-xsend" data-index='5' data-logxsend='[1, 100055, {"score_mode": "3", "price_data": "28", "doc_id": "6432413270", "index":"6", "page_number":"", "small_flow_flag": ""}]'>度米作文汇编之初中英语作文模板教育的重要性
  • 度米作文汇编之英语作文翻译之我的学校MySchool" href=mlhd_7y8en5rbd783hrt8bf1m52amw9lhy70085i_1.html>度米作文汇编之英语作文翻译之我的学校MySchool" target="_blank" data-docid="6642371481" data-edocid="cbc60f93974bcf84b9d528ea81c758f5f71f2946" class="log-xsend tiaoquan act-xsend" data-index='4' data-logxsend='[1, 100055, {"score_mode": "3", "price_data": "28", "doc_id": "6642371481", "index":"5", "page_number":"", "small_flow_flag": ""}]'>度米作文汇编之英语作文翻译之我的学校MySchool
  • 度米作文汇编之往届中考英语话题满分作文范文学做..." href=mlhd_4cinv584z11od1e2lms547le14lox100wge_1.html>度米作文汇编之往届中考英语话题满分作文范文学做好人好事" target="_blank" data-docid="6642373406" data-edocid="6f6d7b85f02d2af90242a8956bec0975f565a44e" class="log-xsend tiaoquan act-xsend" data-index='3' data-logxsend='[1, 100055, {"score_mode": "3", "price_data": "28", "doc_id": "6642373406", "index":"4", "page_number":"", "small_flow_flag": ""}]'>度米作文汇编之往届中考英语话题满分作文范文学做...
联系客服:779662525#qq.com(#替换为@)