
Private Sub Command1_Click()
Dim x As Integer
x=Val(Text 1.Text)
Select Case
Case Is>=90
Text2.Text=“A”
Case Is>=80
Text2.Text=“B”
Case Is
Text2.Text=“C”
Case Is>=60
Text2. Text=“D”
Case Else
End Select
End Sub
x=10
if x<=10:
y=10*x
else:
y=x*20+10
Dim i As Integer, a As Integer
i=6
a=6
If i <6 Then
a = a +4
Else
a = a -4
End If

① ② ③ ④
说明:text1.text、text2.text、text3.text分别表示a,b,max的值
Private Sub Command1_Click()
Dim a AS Integer, b AS Integer
Dim max AS Integer
a=
b=
If then
Else
End Sub
在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 |
Dim i As interger, a As interger
i=1
a=5
If i>3 Then
a=a+9
Else
a=a+6
End if
from microbit import *
while True:
water_ level =pinl. read_ analog () #将p1引脚的模拟值设为变量“water_ level”
if water_ level<300:
display. show (Image. SAD)
else:
display. show (Image. HAPPY)
1)系统随机生成一个1~100的数字;
2)用户总共有5次猜数字的机会;
3)如果用户猜测的数字大于系统给出的数字,打印“too big";
4)如果用户猜测的数字小于系统给出的数字,打印"too small";
5)如果用户猜测的数字等于系统给出的数字,打印"恭喜",并且退出循环;
编写程序代码如下,请完善代码:
#导入random模块
#随机生成1-100的整数并赋值给变量game
time=5
while time>0:
guess=int (input ("请输入你所猜的数字:"))
if (guess>game) :
print ("too big")
elif :
print(" too small' )
else:
print ("恭喜”)
break
time=time-1
print("游戏结束,正确的结果是:",game)
a=4
b=6
avg=(a+b)/3
print(avg)
Num1=4.1
Num2=5.8
age=(Num1+Num2)/2
|
a=int(input("请输入分数: ")) if a>=85: print("优秀") else: if a>=60 and a<85: print("良好") print("继续努力") else: print("待优") print("你需要加把劲了") |

x=int(10.5)*10
x=10
y=x/5
print(y)
Num=123
temp1=Num%10
temp2=Num%100
print(temp1,temp2)
