In visual basic 6.0:
Public input1, input2, number1, output, decimal2, operand, input3 As Double
Public operand2, oprand3 As String
Public decimal3 As Boolean
'Input
Private Sub Command1_Click(Index As Integer)
number1 = number1 + 1
'input1 decimal
If operand = 0 And decimal3 = True Then
number2 = 1 * (10 ^ (number1 - 1))
decimal2 = Index / number2
input1 = input1 + decimal2
Text1.Text = input1
End If
' input2 decimal
If operand > 0 And decimal3 = True Then
number2 = (1 * (10 ^ (number1 - 1)))
decimal2 = Index / number2
input2 = input2 + decimal2
Text1.Text = input1 & " " & operand2 & " " & input2
End If
'input1 single digits
If number1 < 2 And operand < 1 And decimal3 = False Then
input1 = Index
Text1.Text = input1
End If
' input1 multiple digits
If number1 > 1 And operand < 1 And decimal3 = False Then
input1 = (input1 * 10) + Index
Text1.Text = input1
End If
'input2 single digit
If operand > 0 And number1 < 2 And decimal3 = False Then
input2 = Index
Text1.Text = input1 & operand2 & input2
End If
'input2 multiple digits
If number1 > 1 And operand > 0 And decimal3 = False Then
input2 = (input2 * 10) + Index
Text1.Text = input1 & operand2 & input2
End If
End Sub
' Plus/Minus
Private Sub Command2_Click()
If operand < 1 Then
input1 = -1 * input1
Text1.Text = input1
End If
If operand > 1 Then
input2 = -1 * input2
Text1.Text = input1 & " " & operand2 & " ( " & input2 & " ) "
End If
End Sub
' Equals
Private Sub Command3_Click()
Select Case operand
Case Is = 1
output = input1 + input2
Text1.Text = input1 & operand2 & input2 & "=" & output
Case Is = 2
output = input1 - input2
Text1.Text = input1 & operand2 & input2 & "=" & output
Case Is = 3
output = input1 / input2
Text1.Text = input1 & operand2 & input2 & "=" & output
Case Is = 4
output = input1 * input2
Text1.Text = input1 & operand2 & input2 & "= " & output
End Select
input3 = output
number1 = 0
input1 = 0
input2 = 0
output = 0
operand = 0
number2 = 0
decimal2 = 0
decimal3 = False
End Sub
'Plus
Private Sub Command4_Click()
operand = 1
operand2 = "+"
Text1.Text = input1 & operand2
number1 = 0
number2 = 0
decimal3 = False
End Sub
'Minus
Private Sub Command5_Click()
operand = 2
operand2 = "-"
Text1.Text = input1 & operand2
number1 = 0
number2 = 0
decimal3 = False
End Sub
'Divide
Private Sub Command6_Click()
operand = 3
operand2 = "/"
Text1.Text = input1 & operand2
number1 = 0
number2 = 0
decimal3 = False
End Sub
' Multiply
Private Sub Command7_Click()
operand = 4
operand2 = "*"
Text1.Text = input1 & operand2
number1 = 0
number2 = 0
decimal3 = False
End Sub
' POINT
Private Sub Command8_Click()
decimal3 = True
End Sub
' ANS
Private Sub Command9_Click()
If operand = 0 Then
input1 = input3
Text1.Text = input1
End If
If operand > 0 Then
input2 = input3
Text1.Text = input1 & " " & operand2 & " ( " & input2 & " ) "
End If
End Sub
This can be transalted into other VB scripts as the code is quite simple and easy to follow however i have put headings for each section as a guide to it's function
Chat with our AI personalities
Clutch, grab, clasp, grip, seize, hold.
Add the numbers, then divide by three. I don't know vb script, but in most programming languages it would be something like this: result = (a + b + c) / 3
Yes
Velocity = Distance ÷ Time.The speed upstream = 300 ÷ 5 = 60kph.The speed downstream = 300 ÷ 2 = 150 kph.The speed upstream equals boat velocity(Vb) minus current velocity(Vc).The speed downstream equals boat velocity (Vb) pluscurrent velocity (Vc).Vb - Vc = 60Vb + Vc = 150 : Adding the two equations together gives :-2Vb = 210 : Vb = 105, therefore Vc = 45The rate of the boat in still water is 105 kph. The rate of the current is 45 kph.
Its easy.Dim a as IntegerDim b as integerDim count as integercount = 0a = 1b = 2count = a + bThen the result will be 3That's allNeed any help on IT? mail to lasitha2005d@yahoo.com