Private Sub Command_Click()
End Sub
Dim x As Lnteger, y As Integer, z As Integer
Dim x_max As Integer, y_max As Integer, z_max As Integer
Dim f(4, 3, 8) As Single '?????????f??x,y,z)???????f
Dim f_max As Single
'??????????? ??1??1????x,y,z????f(1,1)??x,y,z????f(x,y,z)=4x+3y+2z?????
For x = 0 To 4
For y = 0 To 3
For z = 0 To 8
If (2 * x + 2 * y + z <= 12) And (x + 2 * y + z <= 8) Then
f(x.y.z) = 4 * x + 3 * y + 2 * z
Else
f(x, y, z) = 0
End If
Next z
Next y
Next x
'?????е?f(x,y,z)?У????????
f_max = 0
For x = 0 To 4
For y = 0 To 3
For z = 0 To 8
If f_max < f(x, y, z) Then
f_max = f(x, y, z)
x_max = x
y_max = y
z_max = z
End If
Next z
Next y
Next x
Print "??x="; x_max; ", y="; y_max; ",z="; z_max; "? "
Print "f (x,y,z) ??????="; f_max
End Sub