Dim G As Integer
Dim M As Integer
Input “输入重量 G = ”; G
If then
M=0.65*G
Else
M=
End if
Print “运费为:”; M
x=5
y=-6
If Not x>0 Then x=y-3 Else y=x+3
Print x-y; y-x
i=4
a=5
If i > 3 Then a = a + 5
Else a = a + 2
End If
写出本程序段运行后,变量a的值。
c = 0
For i = 1 To 12
If 12 Mod i = 0 Then
c = c + 1
End If
Next i
Text1.Text = Str(c)
程序运行后,在文本框中输出为:。

Private Sub Command1_Click()
Dim a As Single, b As Single
a = Val(Text1.Text)
b = 10
If a >= b
b = a * a + 2 * b
End If
Label1.Caption = Str(b)
End Sub
|
G=int(input(‘请输入原始成绩:’)) If print(‘Great’) elif G<85 and G>=70: print(‘Good’)
print(‘Medium’) else: print(‘Bad’) |
在VB中有三种程序结构,其中的分支结构中有一种多分支结构,可以针对多种情况进行编程。在编写移动的坦克游戏中,其中有这一段代码
|
1 Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) 2 Select Case KeyCode 3 Case 37 4 Image1.Picture = LoadPicure(App.Path& "\pic\tank1.jpg") 5 If Image1.Left - 20 < 0 Then 6 Image1.Left=0 7 Else 8 Image1.Left= Image1.Left-20 9 End If |
x=3
Select Case x
Case 5
Print "优秀"
Case 4
Print "良好"
Case 3
Print "通过"
Case Else
Print "不通过"
End Select
s='t1Hr2a3'
s1='' ; s2=''; i = 0
while i < len(s):
if '0'<=s[i]<='9':
s1 = s1 + s[i]
elif 'a'<=s[i]<='z':
s2 = s[i] + s2
i = i + 1
ans = s2 + s1
print(ans)
程序执行后,输出的结果是( )
|
n=(input("参加运动会项目名次(1~6):")) # 计算并输出得分
print("得分为14分") elif mc==2: print("得分为10分") elif mc==3: print("得分为8分") elif mc==4: print("得分为6分") elif mc==5: print("得分为4分") elif mc==6: print("得分为2分")
print("输入的名次不在1~6范围") # 方法二 f=[14,10,8,6,4,2] if n>=1 n<=6: print("项目得分为:",cj,"分") else: print("输入的名次不在1~6范围") |
请在完成填空。
a=int(input("请输入你的年龄: "))
if a<=3:
print("没到买票年龄")
elif a>=4 and a<12:
print("请购买儿童票")
else:
print("请购买全价票")
a=input("请你输入一个数字:")
b=input("请你输入一个数字:")
c=input("请你输入一个数字:")
if a<b:
a=b
if a<c:
a=c
print(a) *
x=float(input('请输入用水量:')
if x<=100:
print('您的水费是',x*0.6,'元')
elif x>100 and x<=200:
print('您的水费是',x*0.7,'元')
else:
print('您的水费是',x*0.9,'元') *
Private Sub Command1_ Click()
a=Text2. Text '总评分
If a <75 Then
Label4. Caption ="★ 继续努力!"
Else
If a>90 Then
Label4. Caption ="★★★ 很棒!"
Else
Label4. Caption = "★★ 加油!"
End If
End If
End Sub
x=4 y=3
if x>y:
print(x)
else:
print(y)
屏幕上输出的内容是()
chengji = int( input("请输入百分成绩"))
if chengji >= 85:
print("成绩为:优秀")
else:
print("成绩为:良好")
x=10
if x>=10:
Value=3*x
else:
Value=5*x+10
