77范文网 - 专业文章范例文档资料分享平台

大学计算机基础课后答案(2011)(3)

来源:网络收集 时间:2020-06-21 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

大学计算机基础 第1章 引论

End Module

‘—5—

Module Module1

Sub Main()

Dim A() As Integer = {23, 34, 56, 78, 12, 2, 45, 6, 7, 90} Dim x As Integer = 56 Dim y As Integer = -1

For i As Integer = 0 To A.Length - 1 If x = A(i) Then y = i End If Next

Console.WriteLine(\ End Sub

End Module

‘—6—

Module Module1

Sub Main()

Dim A() As Single = {12, 30} For Each x In A

Console.WriteLine(\ Next

End Sub

Function WaterFee(ByVal x As Decimal) As Decimal If x <= 0 Then Return 0 Else

If x > 0 And x <= 15 Then Return 4 * x / 3 Else

Return 2.5 * x - 10.5 End If End If End Function

End Module

11

大学计算机基础 第1章 引论

‘—7—

Module Module1

Sub Main()

Dim A() As Integer = {23, 34, 56, 78, 12, 2, 45, 6, 7, 90} Dim x As Integer = 56

Console.WriteLine(\

End Sub

Function IsHere(ByVal A() As Integer, ByVal x As Integer) As Integer For i As Integer = 0 To A.Length - 1 If x = A(i) Then Return i End If Next Return -1 End Function

End Module

‘—8—

Module Module1

Sub Main()

Console.WriteLine(\请输入工作时间,工作年数(整数),以空格分隔并以回车结束\

Dim s0 As String = Console.ReadLine() Dim sSplit() As String = s0.Split(\

Dim t, y, sperh As Integer t = Convert.ToInt32(sSplit(0)) y = Convert.ToInt32(sSplit(1)) Dim s As Single

If y >= 5 Then sperh = 50 Else

sperh = 30 End If

If t < 40 Then s = t * sperh

12

大学计算机基础 第1章 引论

Else

s = 40 * sperh + (t - 40) * sperh * 1.5 End If

Console.WriteLine(\工资是{0:N2}\

End Sub

End Module

‘—9—

Module Module1

Sub Main()

Console.WriteLine(\请输入年 月 日,以空格分隔并以回车结束\ Dim s0 As String = Console.ReadLine() Dim sSplit() As String = s0.Split(\

Dim y, m, d As Integer

y = Convert.ToInt32(sSplit(0)) m = Convert.ToInt32(sSplit(1)) d = Convert.ToInt32(sSplit(2))

Dim s As Integer = 0 Dim mm As Integer

For i As Integer = 1 To m - 1

If ((i <= 7) And (i Mod 2 = 1)) Or ((i >= 8) And (i Mod 2 = 0)) Then mm = 31 Else

If i = 2 And (((y Mod 4 = 0) And (y Mod 100 <> 0)) Or (y Mod 400 = 0)) Then

mm = 29 Else

If i = 2 Then mm = 28 Else

mm = 30 End If End If End If s = s + mm Next s = s + d

Console.WriteLine(\

13

大学计算机基础 第1章 引论

End Sub

End Module

‘—10—

Module Module1

Sub Main()

Console.WriteLine(\请输入n\

Dim s As String = Console.ReadLine() Dim n As Integer = Convert.ToInt32(s) Dim y As Integer = 1 For i = 1 To n - 1 y = 2 * (y + 1) Next

Console.WriteLine(\桃子数是{0}\ End Sub

End Module

‘—11—

Module Module1

Sub Main()

For x As Integer = 0 To 50

For y As Integer = 0 To 50 - x If x * 2 + y * 4 = 160 Then

Console.WriteLine(\钥匙扣{0}个,漫画书{1}本\ End If Next Next End Sub

End Module

‘—12—

Module Module1

Sub Main()

For x As Integer = 100 To 999 Dim a As Integer = x Mod 10

Dim b As Integer = (x \\ 10) Mod 10 Dim c As Integer = x \\ 100

14

大学计算机基础 第1章 引论

If a ^ 3 + b ^ 3 + c ^ 3 = x Then

Console.WriteLine(\ End If Next End Sub

End Module

‘—13—

Module Module1

Sub Main()

Dim ins As String = Console.ReadLine() Dim n As Integer = Convert.ToInt32(ins) If IsSquare(n) Then

Console.WriteLine(\ Else

Console.WriteLine(\ End If End Sub

Function IsSquare(ByVal n As Integer) As Boolean Dim i As Integer = 1 For i = 1 To n / i If i * i = n Then Return True End If Next

Return False End Function

End Module

‘—14—

Module Module1 Structure count

Dim x As Integer Dim c As Integer End Structure

Sub Main()

Dim A() As Integer = {2, 3, 3, 3, 4, 5, 5, 5} Dim cou(20) As count Dim i As Integer = 0

For Each k As Integer In A

15

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库大学计算机基础课后答案(2011)(3)在线全文阅读。

大学计算机基础课后答案(2011)(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/jiaoyu/1115987.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: