问题 问答题

在考生文件夹下有一个工程文件sjt5.vbp,在该过程中为考生提供了一个通用过程,考生可以直接调用。请在窗体上画一个名称为Text1的文本框;画一个名称为C1,标题为“计算”的命令按钮;再画两个单选按钮,名称分别为Op1、Op2,标题分别为“求500到600之间能被 7整除的数之和”、“求500到600之间能被3整除的数之和”(如图3—1所示)。请编写适当的事件过程,使得在运行时,选中一个单选按钮,再单击“计算”按钮,就可以按照单选按钮后的文字要求计算,并把计算结果放入文本框中,最后把已经修改的工程文件和窗体文件以原来的文件名存盘。

答案

参考答案:

解析:① 建立界面和设置控件属性。
题目提供了程序用到的控件,修改后的控件及其属性如下表4所示。
表 4

控 件属 性设 置 值
文本框Name
Text
Text1
空白
命令按钮Name
Caption
C1
“计算”
单选按钮Name
Caption
Op1
“求500到600之间能被7整除的数之和”
单选按钮Name
Caption
Op2
“求500到600之间能被3整除的数之和”
② 编写程序代码。
题目提供给考生的代码:
Private Function fun(a As Integer)As
Integer
s%=0
For i%=500 To 600
If Int (i%/a)=i%/a Then
s%=s%+i%
End If
Next
fun=s%
End Function
Private Sub Form_Unload(Cancel As Integer)
Open "out5.txt"For Output As #1
Print #1,Op1. Value,Op2. Value,Text1. Text
Close #1
End Sub
参考代码:
Private Sub C1_Click()
If Op 1. Value Then
Text1. Text=fun(7)
ElseIf Op2.Value Then
Text1.Text=fun(3)
End If
End Sub
③ 按题目要求存盘并进行相应的操作。

选择题
阅读理解

Whatever we may need to buy,we can use our credit cards.This is a change from the older days when we had to first check whether cards were accepted.Today,everybody, from retailers(零售商) to lenders,accepts credit cards.Attitudes towards credit cards have also changed a lot.People used to be

very careful of using their cards;but this is no longer the case. People today prefer to take out their cards as soon as they get to the cash counter.A swipe (刷卡) and a sign are all it takes,and you can walk home with the bill and all the things you buy.

The credit card is much easier to carry than cash and it is not at all surprising that the former becomes the most preferred way of payment.A credit card takes up very little space in our wallets,and yet,it holds the power of a large sum of cash.Paying by credit cards is also a good way of keeping bills on where all of our money goes.  

Moreover,it has become much easier to get credit cards these days.I constantly have cold callers calling up to offer me “great new credit card deals”.Salesmen occasionally walk into our office offering discounts if a group of people decide to sign up a certain kind of credit card plan at the same time.However,this can also cause a problem.Nowadays,we always run the

risk of getting some kinds of wastes.When the terms seem too good to be true,we should make sure that we always read the printed items carefully.Before signing for a creditcard,it is necessary to know its advantages and disadvantages.The only way to deal with this is to do our homework, before we go credit card hunting.   

小题1:We learn from Paragraph 1 that      .   

A.people can use credit cards anytime,anywhere

B.people used to have to check up on credit cards

C.people are more careful using credit cards nowadays

D.people can take their goods home just by swiping their cards小题2:One of the main advantages of credit cards is that   

A.they occupy less space compared with other modes of payment

B.they are more powerful than cash

C.they are easy to get,and save money

D.they help users keep track of what they spend on小题3:When signing for a credit card,people should     .

A.ask for a discount

B.understand the dangers

C.read every word of the contract carefully

D.understand that the salesman is most likely to offer false information小题4:In the last sentence the writer tells us that      .  

A.we should know the advantages and disadvantages of credit cards before using them

B.we should finish work before going shopping with a credit card

C.we should check which credit cards are accepted before using them

D.we should make sure that our credit cards are real before using them