【正文】
程序中的注釋符,把程序中的 ?改為正確的內(nèi)容。 本題主要考查了文件的基本操作、平均值的計(jì)算及查找算法。窗體上有三個文本框 Text Text Text3,其中Text3可顯示多行,并已經(jīng)輸入了內(nèi)容(如圖所示), Text1用來輸入要查找的內(nèi)容, Text2用來輸入要替換的新內(nèi)容。 注意: 存盤時必須存放在考生文件夾下,工程文件名為 ,窗體文件名為 。 第一題考查了 TextBox控件的使有。程序運(yùn)行時,在 Text Text2中輸入文字, 單擊 替 換 按鈕,則在 Text3中找到Text1中的內(nèi)容,并用 Text2中的內(nèi)容替換,若未找到,則不替換。本題主要代碼如下: Dim a(100) As Integer Private Sub Command1_Click() Dim i As Integer Open For Input As 1 For i = 1 To 100 Input 1, a(i) Next i Close 1 End Sub Private Sub Command2_Click() Dim i As Integer, ave As Integer, dec As Integer, res As Integer For i = 1 To 100 ave = ave + a(