- 基础理论
- 数据及数据库技术
- 人工智能
- 算法理论
- 程序设计语言
- 循环结构
- 分支结构
- 顺序结构
- 类、对象、属性、方法、事件和事件处理的概念
- + VB应用程序的界面设计与调试
- 基本数据类型
- 常量、变量、数组
- 常用的标准函数
- 基本运算及表达式
- 赋值语句
- 选择语句
- 循环语句
- 多媒体理论
- 基础软件操作
- 算法软件操作
- 多媒体软件操作
- 网络技术应用
下列叙述正确的是
A.自然语言只能描述顺序结构问题的算法 |
B.同一个问题,算法唯一 |
C.用流程图可以描述循环结构算法 |
D.伪代码就是计算机中直接执行的程序设计语言 |
编写VB程序,实现如下功能:单击“生成密文”按钮Command2,在文本框Text3中产生与每个小写字母对应的密文(每个明文字母对应1个不重复的密文字母)。在文本框Text1中输入单词字符串,单击“加密”按钮Command1后,进行逐个字符加密,加密方法:在“明文”中找到相应字符,再得到明文对应位置的密文,并在文本框Text2中显示对应密文(运行效果如图所示)。实现上述功能的VB代码如下:

Dim m2 As String
Private Sub Command1_Click()
Dim flag(1 To 26) As Boolean
Dim num As Integer,t As Integer
Randomize
num = 1
Text3.Text = " "
For i =" 1" To 26
flag(i) = False
Next i
Do While num <= 26
x =" Int(Rnd" * 26) + 97
①
If flag(t) =" False" Then
m2 =" m2" + Chr(x)
num =" num" + 1
②
End If
Loop
Text3.Text = m2
End Sub
Private Sub Command2_Click()
Dim s As String, m As String, result As String
Dim k As String, c As Integer
s = Text1.Text
m = "abcdefghijklmnopqrstuvwxyz"
For i =" 1" To Len(s)
k =" Mid(s," i, 1)
If k >= "A" And k <= "Z" Then
k =" Chr(Asc(k)" + 32)
End If
c =" 1:" continue = True
Do While③
If k =" Mid(m," c, 1) Then
continue = False
End If
c =" c" + 1
Loop
④
Next i
Text2.Text = result
End Sub
程序①处的代码是
程序②处的代码是
程序③处的代码是
程序④处的代码是

Dim m2 As String
Private Sub Command1_Click()
Dim flag(1 To 26) As Boolean
Dim num As Integer,t As Integer
Randomize
num = 1
Text3.Text = " "
For i =" 1" To 26
flag(i) = False
Next i
Do While num <= 26
x =" Int(Rnd" * 26) + 97
①
If flag(t) =" False" Then
m2 =" m2" + Chr(x)
num =" num" + 1
②
End If
Loop
Text3.Text = m2
End Sub
Private Sub Command2_Click()
Dim s As String, m As String, result As String
Dim k As String, c As Integer
s = Text1.Text
m = "abcdefghijklmnopqrstuvwxyz"
For i =" 1" To Len(s)
k =" Mid(s," i, 1)
If k >= "A" And k <= "Z" Then
k =" Chr(Asc(k)" + 32)
End If
c =" 1:" continue = True
Do While③
If k =" Mid(m," c, 1) Then
continue = False
End If
c =" c" + 1
Loop
④
Next i
Text2.Text = result
End Sub
程序①处的代码是
程序②处的代码是
程序③处的代码是
程序④处的代码是
小王编写了一个VB程序,功能为:在文本框Text1中输入三位自然数,单击“交换”按钮Command1,在文本框Text2中输出由该三位数各位数字重组后的最小数,运行界面如图所示。

(1)若要将按钮上显示的“Command1”改为“交换”,应设置Command1的________________属性。(2)小王编写的按钮事件过程代码如下:
Dim n As Integer, max As Integer
Dim a As Integer, b As Integer, c As Integer
Dim t As Integer,m As Iinteger
x = Val(Text1.Text)
a =" x" \ 100
b = ________①_______________
c =" x" Mod 10
If a >b Then t =" a:" a =" b:" b = t
If a > c Then t =" a:" a =" c:" c = t
If b > c Then t =" c:" c =" b:" b = t
___________②________________
Text2.Text = str(m)
为了实现上述功能,在程序划线处填入合适的代码。[:Zxxk.Com]
①划线处代码:_____________________________________。
②划线处代码:_____________________________________。

(1)若要将按钮上显示的“Command1”改为“交换”,应设置Command1的________________属性。(2)小王编写的按钮事件过程代码如下:
Dim n As Integer, max As Integer
Dim a As Integer, b As Integer, c As Integer
Dim t As Integer,m As Iinteger
x = Val(Text1.Text)
a =" x" \ 100
b = ________①_______________
c =" x" Mod 10
If a >b Then t =" a:" a =" b:" b = t
If a > c Then t =" a:" a =" c:" c = t
If b > c Then t =" c:" c =" b:" b = t
___________②________________
Text2.Text = str(m)
为了实现上述功能,在程序划线处填入合适的代码。[:Zxxk.Com]
①划线处代码:_____________________________________。
②划线处代码:_____________________________________。
日期判断:从文本框Text1输入一个8位数字表示的日期,其中第1到4位表示年(第1位确定不为零),第5到6位表示月,第7到8位表示日。单击“判断”按钮,判断该日期是否合法,将结果依次输出到列表框List1。程序界面如下图所示:
提示:年份值符合下列两种情况之一的是闰年。
1.年份是4的倍数,但不是100的倍数;
2.年份是400的倍数。

(1)观察程序代码,可知“判断”按钮的对象名为 。(单选,填字母:
(2)为实现上述功能,请在划线处填入合适的代码。
Private Sub Judge_Click()
Dim riqi As String, st As String
Dim year As Integer, month As Integer, day As Integer
Dim rn As Boolean, hefa As Boolean
riqi = Text1.Text
year =" Val(Mid(riqi," 1, 4))
month =" Val(Mid(riqi," 5, 2))
day = ① ‘第①处
st =" Str(year)" + "年" + Str(month) + "月" + Str(day) + "日"
rn = False ‘用于判断是否为闰年
If ② Then rn = True ‘第②处
If year Mod 4 =" 0" And year Mod 100 <> 0 Then rn = True
hefa = True ‘用于判断是否为合法日期
If month =" 0" Or month > 12 Then hefa = False
If day =" 0" Then hefa = False
If (month =" 1" Or month =" 3" Or month =" 5" Or month =" 7" Or ’与下一行语句同行
month =" 8" Or month =" 10" Or month =" 12)" And day > 31 Then hefa = False
If (month =" 4" Or month =" 6" Or month =" 9" Or month = 11) ’与下一行语句同行
And day > 30 Then hefa = False
If ③ Then hefa =" False" ’第③处,判断闰年2月的天数是否合法
If month =" 2" And Rn =" False" And day > 28 Then hefa = False
If hefa =" True" Then st =" st" + " 合法日期" Else st =" st" + " 非法日期"
List1.AddItem st
End Sub
提示:年份值符合下列两种情况之一的是闰年。
1.年份是4的倍数,但不是100的倍数;
2.年份是400的倍数。

(1)观察程序代码,可知“判断”按钮的对象名为 。(单选,填字母:
A.Text1/ | B.List1/ | C.Command1/ | D.Judge/E.判断) |
Private Sub Judge_Click()
Dim riqi As String, st As String
Dim year As Integer, month As Integer, day As Integer
Dim rn As Boolean, hefa As Boolean
riqi = Text1.Text
year =" Val(Mid(riqi," 1, 4))
month =" Val(Mid(riqi," 5, 2))
day = ① ‘第①处
st =" Str(year)" + "年" + Str(month) + "月" + Str(day) + "日"
rn = False ‘用于判断是否为闰年
If ② Then rn = True ‘第②处
If year Mod 4 =" 0" And year Mod 100 <> 0 Then rn = True
hefa = True ‘用于判断是否为合法日期
If month =" 0" Or month > 12 Then hefa = False
If day =" 0" Then hefa = False
If (month =" 1" Or month =" 3" Or month =" 5" Or month =" 7" Or ’与下一行语句同行
month =" 8" Or month =" 10" Or month =" 12)" And day > 31 Then hefa = False
If (month =" 4" Or month =" 6" Or month =" 9" Or month = 11) ’与下一行语句同行
And day > 30 Then hefa = False
If ③ Then hefa =" False" ’第③处,判断闰年2月的天数是否合法
If month =" 2" And Rn =" False" And day > 28 Then hefa = False
If hefa =" True" Then st =" st" + " 合法日期" Else st =" st" + " 非法日期"
List1.AddItem st
End Sub