欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    大一计算机课后习题答案.docx

    • 资源ID:97853594       资源大小:33.56KB        全文页数:30页
    • 资源格式: DOCX        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    大一计算机课后习题答案.docx

    3.4Private Sub Command 1 _Click()Image 1.Width = Image 1.Width * 1.2Image 1 .Height = Image 1.Height * 1.2End SubPrivate Sub Command2_Click()Image 1 .Width = Image 1 .Width / 1.2Image 1.Height = Image 1.Height / 1.2End SubPrivate Sub Command3_Click()Image 1 .Width = Form 1. WidthImage 1.Height = Form 1.HeightEnd SubPrivate Sub Form_Load()Image 1.Left = 0Image l.Top = 0Image 1.Picture = LoadPicture(App.Path & "back.jpg") End Sub5 Formla I: S放大缩小全屏3. 5Dim mleft As LongPrivate Sub Command 1 _Click()Timer 1.Enabled = TrueEnd SubQ FormlCD30以内满是勾股定理的数值组合4.12Private Sub Form_Click()Dim m As Integer, n As Integerm = CInt(Val(InputBox(”请输入计算范围的初值”) n = CInt(Val(InputBox("请输入计算范围的终值”) For i = m To ns = 0For j = 1 To i - 1If i Mod j = 0 Then s=s+jEnd IfNext jIf s = i Then Print iNext iEnd Sub4.13Private Sub Form_Click()Dim a As String, c As StringDim b As Integera=InputBox,请输入学生姓名”) b=InputBox(”请输入学生成绩”) Select Case bCase Is <= 39c = "Fail”Case Is <= 49c = "Poor"Case Is <= 59c 二“ Fair”Case Is <= 79c 廿Good”Case Elsec = "Very Good11End SelectPrint"姓名:"&aPrint”成绩:"&bPrint”评语:” &cEnd Sub4.14Private Sub Command 1 _Click()Dim a As Integera = Val(Textl.Text)If a < 10 Or a > 99 Thenerror 1二MsgBox("您输入的不是两位正整数,请重新输入”)ElseFori = 10 To 99al=a10 + (aModl0)*10il = i10 + (i Mod 10)* 10If(a + i = al +il)And (al > 9) And (il > 9) ThenLabel2.Caption = Label2.Caption & Chr(13)&a&& i & ”廿 & al && ilForm 1.Height = Label2.Height + Label2.Top + 1000End IfNextEnd IfEnd Sub:输入一个两位的正整数查找符合条件的对调数4.15Dim a, b, s As DoubleDim flag, com As IntegerPrivate Sub Commandl_Click()If flag = 0 ThenText 1.Text = Text 1.Text & Command 1 .Caption a = Val(Textl.Text)ElseTextl.Text = nnflag = 0Text 1.Text = Textl.Text & Command 1 .Caption a = Val(Textl.Text)End IfEnd SubPrivate Sub Command2_Click()If flag 二 0 ThenTextl.Text 二 Textl.Text & Command2.Caption a = Vai (Textl.Text)ElseTextl.Text = ,nflag = 0Textl.Text = Textl.Text & Command2.Caption a = Vai (Textl.Text)End IfEnd SubPrivate Sub Command3_Click()If flag = 0 ThenText 1.Text = Textl.Text & Command3.Caption a = Val(Textl.Text)ElseTextl.Text = nnflag = 0Text 1.Text = Text 1.Text & Command3.Caption a = Val(Textl.Text)End IfEnd SubPrivate Sub Command4_Click()If flag = 0 ThenText 1.Text = Text 1.Text & Command4.Captiona = Vai (Text 1.Text)ElseTextl.Text = nnflag = 0Textl.Text = Textl.Text & Command4.Caption a = Vai (Textl.Text)End IfEnd SubPrivate Sub Command5_Click()If flag = 0 ThenTextl.Text = Textl.Text & Command5.Caption a = Vai (Textl.Text)ElseTextl.Text = ,1nflag = 0Textl.Text = Textl.Text & Command5.Caption a = Val(Textl.Text)End IfEnd SubIf flag = 0 ThenText 1.Text = Text 1.Text & Command6.Caption a = Vai (Text 1.Text)ElseTextl.Text = nnflag = 0Textl.Text = Textl.Text & Command6.Caption a = Val(Textl.Text)End IfEnd SubPrivate Sub Command7_Click()If flag = 0 ThenTextl.Text = Textl.Text & Command7.Caption a = Val(Textl.Text)ElseTextl.Text =nnflag = 0Textl.Text = Textl.Text & Command7.Caption a = Val(Textl.Text)End IfEnd SubPrivate Sub Command8_Click()If flag = 0 ThenTextl.Text = Textl.Text & Command8.Caption a = Val(Textl.Text)ElseTextl.Text =flag = 0Text 1 .Text = Textl.Text & Command8.Caption a = Val(Textl.Text)End IfEnd SubPrivate Sub Command9_Click()If flag = 0 ThenTextl.Text = Textl.Text & Command9.Captiona = Val(Textl.Text)ElseTextl.Text = nnflag = 0Text 1.Text = Text 1.Text & Command9.Captiona = Val(Textl.Text)End IfEnd SubPrivate Sub Command 10_Click()If flag = 0 ThenText 1.Text = Text 1.Text & Command 10.Caption a = Val(Textl.Text)ElseText 1 .Text ="”flag = 0Text 1.Text = Text 1.Text & Command 10.Caption a = Vai (Text 1.Text)End IfEnd SubPrivate Sub Command 1 l_Click()If flag = 0 ThenText 1.Text = Text 1.Text & Command 11 .Caption a = Vai (Text 1.Text)ElseText 1 .Text 二”flag = 0Text 1.Text 二 Text 1.Text & Command 11 .Caption a = Vai (Text 1.Text)End IfEnd SubPrivate Sub Command 12_Click()Select Case coma = b + aText 1.Text = aflag = 1Case 1 a = b - aText 1.Text = aflag = 1Case 2 a = b * aText 1,Text = aflag = 1Case 3 a = b / aText 1.Text = aflag = 1End SelectEnd SubPrivate Sub Command 13_Click()b = aflag = 1 com = 1End SubPrivate Sub Command 14_Click()b = aflag = 1com = 2End SubPrivate Sub Command 15_Click()b = aflag = 1com = 3End Subb = a flag = 1 com = 4End SubPrivate Sub Form_Click()Dim a(l To 20)For i = 1 To 20a(i) = InputBox("请输入第" & i & “个元素”)Next iFor i = 1 To 20Print a(i); " ”;Next iPrintFor i = 1 To 10t = a(i)a(i) = a(21 - i)a(21 - i) = tNext iFor i = 1 To 20Print a,Next iEnd SubPrivate Sub Form_Click()Dim a(l To 10, 1 To 10)For i = 1 To 10For j = 1 To 10If i = j Thena(i,j)= 1Elself i + j = 11 Thena(i,j)= 1Elsea(i, j) = 0End IfNext jNext iFor i = 1 To 10For j = 1 To 10Print a(i, j);Next jPrintNext iEnd SubPrivate Sub Form_Click()Dim a() As Integern = InputBox(" 请输入 nn)m = InputBox("请输入 m”)Print ”数组为“ &n& ”行”&m& ”列”ReDim a(n, m)For i = 1 To nFor j = 1 To ma(ij) = InputBox(”请输入第“ & i & ”行” &j & ”列”)Next jNext iFor i = 1 To nFor j = 1 To mPrint a(i, j);Next jPrintNext is = 0For i = 1 To nFor j = 1 To ms = s + a(i,j)Next jNext iv = s / (n * m)Print”平均值为:” &vFor i = 1 To nFor j = 1 To mIf a(i, j) > v ThenPrint"元素:"&a(i,j)&”行号:"&i&”列号:n&jEnd IfNext jNext iEnd SubPrivate Sub Form_Click()Dim a(l To 50, 1 To 4) As IntegerFor i = 1 To 50For j = 1 To 4a(i,j) = Int(Rnd*90+ 10)Next jNext i显示满足条件的行For i = 1 To 50For j = 1 To 4Ifa(iJ)>90 ThenFor k = 1 To 4Print a(i, k) & H ”;Next kPrintExit ForPrivate Sub Command2_Click()Timer 1.Enabled = FalseEnd SubPrivate Sub Timerl_Timer()mleft = Label 1.Left + 100If mleft + Label 1 .Width > Picture 1.Width Then mleft = 0End IfLabel 1 .Left 二 mleftEnd Sub5 Forml欢迎您屋;Private Sub Form_Load()Forml .ShowFor i = 1 To 4a = InputBox("请输入数值型数据”)Sum 二 Sum + aave = Sum / 4NextPrint Sum; aveEnd SubEnd IfNext jNext i显示完整数组For i = 1 To 50For j = 1 To 4Print a(ij)&n";Next jPrintNext iEnd SubPrivate Sub Form_Click()Dim n As Integer, m As IntegerDim a() As Integern = InputBox(”请输入行数n")m = InputBox("请输入列数m”)ReDim a(l To n, 1 To m)For i = 1 To nFor j = 1 To ma(ij) = InputBox(”请输入第“ & i & ”行”&j & ”列的元素”) Next jNext iFor i = 1 To nFor j = 1 To mPrint Format(a(i, j), n000n) & ” n;Next jPrintNext ian_num = 0For i = 1 To nhmax = a(i, 1)Ihao = 1For j = 1 To mIf a(i, j) > hmax Then hmax = a(i, j) Ihao = jEnd IfNext jImin = a(i, Ihao)For k = 1 To nIf a(k, Ihao) < Imin ThenImin = a(k, Ihao)End IfNext kIf Imin = hmax ThenPrintn鞍点为:n & i && Ihao &an_num = an_num + 1End IfNext iIf an_num = 0 Then Print ”无鞍点”End SubPrivate Sub Form_Click()Dim a(l To 3, 1 To 3) As IntegerDim b(l To 3, 1 To 3) As IntegerDim c(l To 3, 1 To 3) As IntegerFor i = 1 To 3For j = 1 To 3a(i,j) = Int(Rnd*90+ 10)b(i,j) = Int(Rnd*90+ 10)Next jNext iPrint ”数组 A:"For i = 1 To 3For j = 1 To 3Print a(i,j)&n ”;Next jPrintNext iPrint ”数组 B:nFor i = 1 To 3For j = 1 To 3Print b(ij)&n ";Next jPrintNext iFor i = 1 To 3For j = 1 To 3c(ij) = a(i,j) + b(ij)Next jNext iPrint ”数组 C:nFor i = 1 To 3Forj = 1 To 3Print c(ij)&n”;Next jPrintNext iEnd SubPrivate Sub Form_Click()Dim a(l To 10, 1 To 3)Dim s As Integer, av As IntegerFor i = 1 To 10a(i, 1) = InputBox(”请输入第“ & i & ”个学生的姓名”)a(i, 2) = InputBox。请输入第” & i & “个学生的学号”)a(i, 3) = InputBox(”请输入第“ & i & ”个学生的成绩”)Next iPrint ”原始数据为:“Print ”姓名学号“成绩”For i = 1 To 10Forj = 1 To 3Print a(i, j),Next jPrintNext is = 0For i = 1 To 10s = s + a(i, 3)Next iav = s / 10Print ”平均成绩为:" & avPrint ”姓名学号”,”成绩奖金等级”For i = 1 To 10If a(i, 3)>av* 1.1 ThenPrint a(i, 1), a(i, 2), a(i, 3), “一等奖”Elself a(i, 3) > av * 1.05 ThenPrint a(i, 1), a(i, 2), a(i, 3), “二等奖”End IfNext iEnd SubPrivate Sub Form_Click() Dim a( l To 10, 1 To 4) For i = 1 To 10a(i, 1) = InputBox(”请输入第“ & i & ”个学生的姓名”) a(i, 2) = Val(InputBox("请输入第“ & i & “个学生的语文成绩”) a(i, 3) = Val(InputBox("请输入第“ & i & ”个学生的数学成绩”) a(i, 4) = (a(i, 2) + a(i, 3)/ 2Next iPrint “姓名“,“语文“,“数学“,“平均分”For i = 1 To 10For j = 1 To 4Print a(i,j), Next j PrintNext iFori = 10 To 2 Step-1For j = 1 To i - 1Ifa(j,4)<a(j + 1,4) Then t =1)a(j, l) = a(j + 1, 1) a(j + 1, l) = t t = a(j, 2) a(j, 2) = a(j + 1, 2) a(j + l,2) = t t = a(j, 3) a(j, 3) = a(j + 1, 3) a(j + l,3) = t t = a(j, 4) a(j,4) = a(j + 1,4) a(j + l,4) = tEnd IfNext jNext iPrint "姓名:'语文“,“数学“,“平均分”For i = 1 To 10For j = 1 To 4Print a(i,j), Next j PrintNext iEnd SubPrivate Sub Form_Click()Dim a, b, c(0 To 5) As Integera = Array(2, 8, 7, 6, 4, 28, 70, 25)b = Array(79, 27, 32, 41, 57, 66)Print nA数组的内容:“For Each x In aPrint x,Next xPrintPrint 数组的内容:“For Each x In bPrint x,Next xPrintPrint nC数组的内容:“For i = 0 To 5c(i) = a(i) + b(i)Print c(i),Next iEnd Sub5.10Private Sub Form_Click()Dim a( 1 To 4, 1 To 4) As IntegerFor i = 1 To 4For j = 1 To 4a(i,j) = InputBox(”请输入第“ & i & ”行第”&j & ”列的元素”)Next jNext iPrint ”原始数组:"For i = 1 To 4For j = 1 To 4Print a(i,j),Next jPrintNext iPrint ”主对角线:“For i = 1 To 4Print a(i, i),Next iPrintPrint ”另一条对角线:“For i = 1 To 4Print a(i, 5 - i),Next iPrintFor i = 1 To 4s = 0For j = 1 To 4s = s + a(i,j)Next jPrint "第“ & i & ”行的和为:" & s Next iFor i = 1 To 4s = 0For j = 1 To 4s = s + a。,i)Next jPrint "第” & i &咧的和为:" & sNext iFor i = 1 To 4t = a(l,i)a(l, i) = a(3, i)a(3, i) = tNext iFor i = 1 To 4t = a(i, 2)a(i, 2) = a(i, 4)a(i, 4) = tNext iPrint ”结果数组:"For i = 1 To 4For j = 1 To 4Print a(i,j),Next jPrintNext iEnd Sub5.11Private Sub Form_Click()Dim a()Dim n As Integern = InputBox(”请输入人数N") ReDim a(l To n, 1 To 5)For i = 1 To na(i, 1) = InputBox(”请输入第“ & i & ”个人的姓名”)a(i, 2) = InputBox(”请输入第“ & i & ”个人的性别”)a(i, 3) = InputBox。请输入第“ & i & ”个人的年龄”)a(i, 4) = InputBox。请输入第” &i & ”个人的文化程度”)a(i, 5) = InputBox。请输入第” & i & ”个人的籍贯”)Next iPrint ”原始数据:“Print ”姓名性别年龄文化程度籍贯”For i = 1 To nFor j = 1 To 5Print a(i,j),Next jPrintNext iPrint ”查找的结果:"x = 6Do While x = 6sn = InputBox("请输入要查找的人的姓名”)For i = 1 To nIf sn = a(i, 1) ThenFor j = 1 To 5Print a(i,j),Next jPrintExit ForEnd IfNext iIfi>n Then Print ”没有找到该人”x = MsgBox("你是否还要继续查找?二 vblnformation + vbYesNo,"提问") Loop End Sub5.12Private Sub Form_Click()Dim a(l To 10, 1 To 2)Fori = 1 To 10a(i, 1) = CStr(InputBox("请输入运动员号”)a(i, 2) = Val(InputBox(”请输入成绩”)Next iPrint ”原始的顺序”Print ”运动员号“,“成绩”For i = 1 To 10Forj = 1 To2Print a(ij),Next jPrintNext iFor i = 10 To 2 Step -1For j = 1 To i - 1Ifa(j,2)>a(j + 1,2) Then t = a(j, 2) a(j,2) = a(j + l,2) a(j + l,2) = t t = a(j, 1) a(j, l) = a(j + 1, 1) a(j+ 1, l) = tEnd IfNext jNext iPrint”排列的顺序”Print “名次”,“运动员号“,“成绩”For i = 1 To 10Print i,Forj = 1 To 2Print a(ij),Next jPrintNext iEnd Sub5.13Private Sub Form_Click() Dim a(ll, 11)For i = 1 To 11a(i, 1)= 1a(i, i)= 1Next iFor i = 3 To 11Forj = 2To 10a(i,j) = a(i- 1J - l) + a(i- 1 J) Next jNext iFor i = 1 To 11For j = 1 To iPrint Format(a(i, j),Next jPrintNext iEnd Sub6.4Private Sub Form_Click()Dim i As LongFor i = 1 To 1000If Automorphic(i) Then Print iNext iEnd SubPrivate Function Automorphic(n As Long) As BooleanDim t As Long, 1 As Integer1 = Len(CStr(n)t = n * nAutomorphic = Right(CStr(t), I) = CStr(n)End Function6.6Private Sub Form_Click()For i = 1 To 20Print i & ”的立方为:" & m_pf(i)Next iEnd SubPrivate Function m_pf(x)m_pf = x * x * xEnd Function6.8Private Sub Form_Click()Dim a As Integera = InputBox("请输入一个整数”)If is_bin(a) ThenPrint ”偶数”ElsePrint ”奇数End IfEnd SubPrivate Sub Form_Load()End SubPrivate Function is_bin(n As Integer) As BooleanIf n Mod 2 = 0 Thenis_bin = TrueElseis_bin = FalseEnd IfEnd Function6.9Const pi = 3.1415926Private Sub Form_Click()Print ”余下的面积为:" & C_S(10) - C_S(5) - C_S(3)End SubPrivate Function C_S(r As Single) As SingleC_S = pi * r * rEnd Function6.10Private Sub Form_Click()Print ”第五人的年龄为:" & n_age(5)End SubPrivate Function n_age(n As Integer) As IntegerIf n = 1 Thenn_age = 10Elsen_age = n_age(n -1) + 2End IfEnd Function练习题答案第一章一选择:ccbbdbbda = 5b = 2.5c = 7.8pi = 3.14159265y = pi*a*b/a + b*cPrint yEnd Sub5 Forml计算4.4Private Sub CommandlClick()a = Vai (Textl. Text)tian = a 86399xiaoshi = (a - tian * 86400) 1439fenzhong =(a - tian * 86400 - xiaoshi * 1440) 59miao = a - tian * 86400 - xiaoshi * 1440 - fenzhong * 60Text2. Text = tian & 天 & xiaoshi & 小时 & fenzhong &分钟 & miao& 秒End Sub二填空1、学习版、专业版、企业版2 、 alt+f43 、 .vbp> . frm 4、固定、浮动 5、 ABCD> vb programming 6、属性窗口、运行 7、对象、过程8、窗体模块、标准模块、类模块 第二章一、选择 bbbbdd 二、填空 1(x+y)+z)*80-5* (c+d)2 cos(x)*(sin(x)+l) 32*a*(7+b)4 8*exp (3)*log(2)5 goodmorning>goodmorning6 25、 8、 2001、7第三章 一、选择题Cbda(d . 3 或 both) cbccdbcbbabdcc (第五题俩选项) 二填空 1 autosize 2 textl. setfocuse 3 0、04 picturel. picture=loadpicture( "yygif" ) 5 stretch 6 interval7 enabled8 简单组合框、下拉式组合框、下拉式列表框、style9 下拉式列表框10 条目1、条目311 欢迎您到中国来、welcome to china 第四章一、 选择题bccbcbcbdababdabacb二、 填空1 2542=57 2 beijingO 3002.452.44924.49e-0. 1-2.449549 10 115 836 37 Y=iif (x<=0, 0, iif (x<=10, 5+2*x, iif (x<=15, x-5, 0)8 答案不唯一:x>6或x=7或x>=79 x>=0>x<min1010241112Q Forml:输入秒数:4.5Private Sub Commandl_Click()Const g As Single = 9. 81t = InputBox(请输入t的值)vO = InputBox(请输入 vO 的值) s=l/2*g*t*t+v0*t Print Format (s, 0. #)End Sub5 Forml4.6Private Sub Commandl_Click()Sum = 0For i = 2 To 100 Step 2Sum = Sum + iNextLabell. FontSize = 20Label1. Caption = "2+4+6+100=& Sum4.7Private Sub Commandl_Click()Doa = InputBox(请输入三角形的第一条边长)al = Vai(a)If al = -1 ThenEndEnd Ifb = InputBox(请输入三角形的第二条边长)bl = Vai (b)If bl = -1 ThenEndEnd Ifc = InputBox(请输入三角形的第三条边长)cl = Vai (c)If cl =-1 ThenEndEnd IfIf (al + bl > cl) And (al + cl > bl) And (bl + cl > al) Then s = al + bl + cl Exit DoElseError 1 = MsgBox (您输入的数据不能组成三角形)End IfLoopLabel4. Caption =您输入的边长分别为: & al & , & bl & / & cl & & 面积为: & s5 Forml计算4.8Private

    注意事项

    本文(大一计算机课后习题答案.docx)为本站会员(太**)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开