VB编程六题,速答
展开全部
Dim n As Integer
Private Sub Command1_Click()
n = InputBox("N=")
Command1.Enabled = False
Command2.Enabled = True
Label1.Caption = "求满足1+2+3+……+X ≤" & n & " 的最大值"
End Sub
Private Sub Command2_Click()
S = 0
I = 1
While S + I <= n
S = S + I
I = I + 1
Wend
Label1.Caption = "求满足1+2+3+……+" & I - 1 & " ≤" & n & " 的最大值"
End Sub
Private Sub Form_Load()
Label1.Caption = "求满足1+2+3+……+ X ≤ N的最大值"
Label1.FontSize = 12
Label1.ForeColor = vbBlue
Label1.FontBold = True
Command1.Caption = "输入N值"
Command2.Caption = "计算X值"
Command2.Enabled = False
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询