永发信息网

两道VB编程题大学水平不是很难

答案:3  悬赏:80  手机版
解决时间 2021-06-05 19:11
  • 提问者网友:缘字诀
  • 2021-06-04 19:25

1.编写程序,计算2+4+6+...+100

2.从键盘上输入一个学生的的学号和考试成绩,然后输出该学生的学号和考试成绩,并根据成绩按下面的规定输出对该学生的评语:

成绩 80~100 60~79 50~59 40~49 0~39

评语 Very good Good Fair Poor Fail

我不要你说方法 就是详细步骤 写在卷子上能给分的 别让我查资料 能查到我也不会再问问上问 摆脱了

最佳答案
  • 五星知识达人网友:青尢
  • 2021-06-04 20:02

1:


For i = 2 To 100 Step 2
sum = sum + i
Next
msgbox sum




第二题:


Xh = Inputbox("请输入学号")
score = Val(Inputbox("请输入分数"))



Select Case score
Case Is < 60
str = "Fail"
Case 40 To 49
str = "Poor"
Case 50 To 59
str = "Fair"
Case 60 To 79
str = "good"
Case 80 To 100
str = "very good"
End Select



Print "学号:"; XH


Print "考试成绩"; score
Print "评语:"; str

全部回答
  • 1楼网友:行路难
  • 2021-06-04 22:21

第一题:

Dim i As Integer Dim sum As Integer sum = 0 For i = 2 To 100 Step 2 sum = sum + i Next i Print sum

第二题:

Dim id As Integer Dim score As Integer Dim str As String id = Val(Text1.Text) score = Val(Text2.Text) Select Case score Case Is < 60 str = "Fail" Case 40 To 49 str = "Poor" Case 50 To 59 str = "Fair" Case 60 To 79 str = "good" Case 80 To 100 str = "very good" End Select Print "学号:"; id Print "考试成绩"; score Print "评语:"; str

  • 2楼网友:慢性怪人
  • 2021-06-04 20:53

1:

dim index , sum

sum = 0

for index = 2 to 100 step 2

sum = sum + index

next

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯