| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 824 人关注过本帖
标题:计算机二级上机真题
只看楼主 加入收藏
若前1309
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-9-12
收藏
 问题点数:0 回复次数:2 
计算机二级上机真题

有2个命令按钮: 读数据和统计,单击读数据,则将文件夹内容写进去(只有字母和空格)显示在TEXT1中。TEXT1选中内容后,单击统计,则自动统计选中文本中从未出现过的字母,将这些字母以大写的形式显示在TEXT2中。求问号部分怎么写?????
Option Base 1
Dim x As String, max_n As Integer
Private Sub Command1_Click()
Open App.Path & "\in4.dat" For Input As #1
s = Input(LOF(1), #1)
Close #1
Text1.Text = s
End Sub

Private Sub Command2_Click()
Dim a(26) As Integer

sl = Text1.SelLength
st = Text1.SelText
Text2.Text = ""

' If ? Then
MsgBox "请先选择文本!"
Else
' For i = 1 To ?
c = Mid(st, i, 1)
If c <> " " Then
n = Asc(UCase(c)) - Asc("A") + 1
' a(n) = ?
End If
Next
' For i = 1 To ?
If a(i) = 0 Then
Text2.Text = Text2.Text + " " + Chr(Asc("A") + i - 1)
End If
Next
End If
End Sub

搜索更多相关主题的帖子: 计算机 上机 
2007-09-12 23:46
景彡
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2009-7-1
收藏
得分:0 
做了一下,大概如下,不过有个问题,就是读入数据之后要手动地把text1里的数据选中一下再点“统计”按钮。
Dim x As String, max_n As Integer
 
Private Sub Command1_Click()
Open App.Path & "\in4.dat" For Input As #1
s = Input(LOF(1), #1)
Close #1
Text1.Text = s
End Sub
 
Private Sub Command2_Click()
Dim a(26) As Integer
 
sl = Text1.SelLength
st = Text1.SelText
Text2.Text = ""
 
If Text1.Text = "" Then
MsgBox "请先选择文本!"
Else
For i = 1 To sl
c = Mid(st, i, 1)
If c <> " " Then
n = Asc(UCase(c)) - Asc("A") + 1
a(n) = 1
End If
Next
For i = 1 To 26
If a(i) = 0 Then
Text2.Text = Text2.Text + " " + Chr(Asc("A") + i - 1)
End If
Next
End If
 
End Sub
2009-09-17 12:46
czqnazz00
Rank: 2
等 级:论坛游民
帖 子:38
专家分:34
注 册:2009-7-16
收藏
得分:0 
修改后如下:
Option Base 1
Dim x As String, max_n As Integer
Private Sub Command1_Click()
Open App.Path & "\in4.dat" For Input As #1
s = Input(LOF(1), #1)
Close #1
Text1.Text = s
End Sub

Private Sub Command2_Click()
Dim a(26) As Integer
'Dim n As Integer
sl = Text1.SelLength
st = Text1.SelText
Text2.Text = ""

If sl = 0 Then
    MsgBox "请先选择文本!"
Else
 For i = 1 To sl
c = Mid(st, i, 1)
If c <> " " Then
n = Asc(UCase(c)) - Asc("A") + 1
 a(n) = n
End If
Next
 For i = 1 To 26
If a(i) = 0 Then
Text2.Text = Text2.Text + " " + Chr(Asc("A") + i - 1)
End If
Next
End If
End Sub
2009-09-18 10:10
快速回复:计算机二级上机真题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026980 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved