.


:




:

































 

 

 

 


2.




VBA

Private Sub CommandButton1_Click()

MsgBox " : " & TextBox2.Text, vbOKOnly + vbInformation, "2"

 

End Sub

 

Private Sub CommandButton2_Click()

MsgBox " Click 4", vbOKOnly, "4"

End Sub

 

Private Sub CommandButton3_Click()

MsgBox "3 3 3", vbOKOnly + vbExclamation, "3"

End Sub

 

Private Sub CommandButton4_Click()

MsgBox " Click 1", vbOKOnly, "1"

End Sub

 

 

 

 

 

1)

Dim a As Single, b As Single, c As Single

 

a = InputBox("a-?")

b = InputBox("b-?")

c = ((a + b) * (a + b - 1) * (Sin(a))) / (2 * a - b)

MsgBox "c=" & c

 

2) .

 

Dim x As Single, y As Single, otvet As Single

x = Val(TextBox1.Text)

y = Val(TextBox3.Text)

otvet = ((3.14 * x ^ 2) / 2) - (3.14 * y ^ 2) / 2

Label4.Caption = Format(otvet, "0.000")

 

 

. IF.

1. 2 .

Dim a As Single, b As Single, c As Single

 

a = InputBox("a-?")

b = InputBox("b-?")

c = ((a + b) * (a + b - 1) * (Sin(a))) / (2 * a - b)

MsgBox "c=" & c

If OptionButton1.Value = True Then

Open "D:\Student\-113\primer.txt" For Output As #1

Print #1, "a="; Format(a, "0.000")

Print #1, "b="; Format(b, "0.000")

Print #1, "c="; Format(c, "0.000")

Close #1

ElseIf OptionButton2.Value = True Then

Open "D:\Student\-113\primer.txt" For Append As #1

Print #1, "a="; Format(a, "0.000")

Print #1, "b="; Format(b, "0.000")

Print #1, "c="; Format(c, "0.000")

Close #1

End If

 

 

Private Sub CommandButton2_Click()

Dim x As Single, y As Single, otvet As Single

x = Val(TextBox1.Text)

y = Val(TextBox3.Text)

otvet = ((3.14 * x ^ 2) / 2) - (3.14 * y ^ 2) / 2

Label4.Caption = Format(otvet, "0.000")

 

If OptionButton1.Value = True Then

Open "D:\Student\-113\primer.txt" For Output As #1

Print #1, " ="; Format(x, "0.000")

Print #1, " ="; Format(y, "0.000")

Print #1, "="; Format(otvet, "0.000")

Close #1

ElseIf OptionButton2.Value = True Then

Open "D:\Student\-113\primer.txt" For Append As #1

Print #1, " ="; Format(x, "0.000")

Print #1, " ="; Format(y, "0.000")

Print #1, "="; Format(otvet, "0.000")

Close #1

End If

 

=3563.000

=2.000

=19931100.000

=1234456.000

=1.000

=2392494000000.000

=9999.000

=15456.000

=-218085500.000

a=5.000

b=4.000

c=-11.507.000

 

 

2. .

 

Private Sub CommandButton1_Click()

Dim x As Double, kpo As Integer

Open "D:\Student\-113\primer2.txt" For Output As #1

kpo = 0

 

x = InputBox(" 22?")

If x = 4 Then MsgBox "True": kpo = kpo + 1 Else MsgBox "False", vbCritical

Print #1, " 1 : 22?"

Print #1, " :"; x

 

x = InputBox(" 1-3-5?")

If x = 7 Then MsgBox "True": kpo = kpo + 1 Else MsgBox "False", vbCritical

Print #1, " 2 : 1-3-5?"

Print #1, " :"; x

 

x = InputBox(" ?")

If x = 7 Then MsgBox "True": kpo = kpo + 1 Else MsgBox "False", vbCritical

Print #1, " 3 : ?"

Print #1, " :"; x

 

MsgBox " - =" & Str(kpo)

Print #1, "- ="; kpo

Close #1

 

End Sub

 

1 : 22?

: 4

2 : 1-3-5?

: 7

3 : ?

: 7

- = 3

 

 

\





:


: 2015-11-05; !; : 464 |


:

:

.
==> ...

1964 - | 1838 -


© 2015-2024 lektsii.org - -

: 0.013 .