程序代码如下:
Private Sub Form Click()
Dim ji As Integer ‘鸡
Dim tu As Integer ‘兔
Dim tui As Integer ‘腿数
Dim tou As Integer ‘头数
For ji=
For tu=1 to 25
tui= ‘计算腿的数量
tou= ji+tu ‘计算头的数量
IFThem
Print ji, tu
End If
Next tu
Next ji
End sub
for i in ① :
print("第",i,"位同学")
a=0
for j in ② :
a=a+int(input("请输入第"+str(j)+"科考试成绩:"))
print("该生的总成绩为:",a)
对象名 |
属性名 |
属性 |
Command1 |
计算 |
Private Sub Command1_Click()
Dim i, s As Integer
s =
For i = 0 To 100 Step 1
Next i
Label2.Caption = Str(s)
End Sub
Dim x As Integer
x=2
Do while x<=63
x=(x+1)*(x-1)
Loop
Sub mult( )
Dim Sum As Integer
Sum=0
Dim i as integer
For to 50
If i MOD 2= Then
End if
Next i
Print sum
End Sub
图1 图2 |
Private sub Form1_click( )
For s= to 1 step
Print “无人机继续向前移动”
Print“无人机停止移动,并转向”
End sub
a=0
while a<5:
a=a+1
print(a)
百千白鸡问题是经典的数学问题,原题为“鸡翁一,值钱五;鸡母一,值钱三;鸡雏三,值钱一;百钱买百鸡,则翁、母、雏各几何?”翻译过来,意思是公鸡一个五块钱,母鸡一个三块钱,小鸡三个一块钱,现在要用一百块钱买一百只鸡,问公鸡、母鸡、小鸡各多少只?
import random
while True:
x=random.randrange(0,20)
y=random.randrange(0,33)
z=random.randrange(0,100)
if 5*x+3*y+z/3==100 and x+y+z==100:
print('公鸡',x)
print('母鸡',y)
print('小鸡',z)
s="abcdefg"
c=len(s) #len 求字符串长度
for i in range(0,c):
if i<2:
print (chr(ord(s[i])+2),end=" ") # ord()函数是chr()函数配对函数,将字符转ASCII值
else:
print(chr(ord(s[i]) + 3),end=" ")
for i in range (10):
print (i)
b=1
Do while (b<40)
b=b*(b+1)
Loop
Print b
S = 0
For k = To step
S =
Next k
Print "1+2+3+……+150="; S