1.用程序计算数学表达式S=1的计算积源积平方-2的平方+3的平方-4的平方+...+N的平方 需VB程序的源代码
2.求VB源代码!!长方长方程序!形面形面日月传说 源码
3.如何用VB做一个简单计算器 要求实现加减乘除乘方开方功能
用程序计算数学表达式S=1的平方-2的平方+3的平方-4的平方+...+N的平方 需VB程序的源代码
Private Sub Command1_Click()
n = InputBox("请输入n:")
a = 1
For i = 1 To n
s = s + a * i ^ 2
a = -a
Next i
Print "s=" & s
End Sub
求VB源代码!!计算积源积ashik线指标源码!长方长方程序深圳社交app源码
用记事本把下面的形面形面代码保存到Form1.Frm文件中。然后用VB打开,代码试试吧。计算积源积
===========
VERSION
5.
Begin
VB.Form
Form1
BorderStyle
=
1
'Fixed
Single
Caption
=
"打地鼠"
ClientHeight
=
ClientLeft
=
ClientTop
=
ClientWidth
=
LinkTopic
=
"Form1"
MaxButton
=
0
'False
MinButton
=
0
'False
ScaleHeight
=
ScaleWidth
=
StartUpPosition
=
3
'窗口缺省
Begin
VB.CommandButton
Command1
Caption
=
"开始"
Height
=
Left
=
0
TabIndex
=
9
Top
=
Width
=
End
Begin
VB.Timer
Timer1
Interval
=
Left
=
Top
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
8
Left
=
ScaleHeight
=
ScaleWidth
=
TabIndex
=
8
Top
=
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
7
Left
=
ScaleHeight
=
ScaleWidth
=
TabIndex
=
7
Top
=
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
6
Left
=
0
ScaleHeight
=
ScaleWidth
=
TabIndex
=
6
Top
=
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
5
Left
=
ScaleHeight
=
ScaleWidth
=
TabIndex
=
5
Top
=
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
4
Left
=
ScaleHeight
=
ScaleWidth
=
TabIndex
=
4
Top
=
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
3
Left
=
0
ScaleHeight
=
ScaleWidth
=
TabIndex
=
3
Top
=
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
2
Left
=
ScaleHeight
=
ScaleWidth
=
TabIndex
=
2
Top
=
0
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
1
Left
=
ScaleHeight
=
ScaleWidth
=
TabIndex
=
1
Top
=
0
Width
=
End
Begin
VB.PictureBox
Picture1
Height
=
Index
=
0
Left
=
0
ScaleHeight
=
ScaleWidth
=
TabIndex
=
0
Top
=
0
Width
=
End
Begin
VB.Label
Label1
AutoSize
=
-1
'True
Height
=
Left
=
TabIndex
=
Top
=
Width
=
End
End
Attribute
VB_Name
=
"Form1"
Attribute
VB_GlobalNameSpace
=
False
Attribute
VB_Creatable
=
False
Attribute
VB_PredeclaredId
=
True
Attribute
VB_Exposed
=
False
Dim
i
As
Integer,长方长方程序
t
As
Integer
Private
Sub
Command1_Click()
On
Error
GoTo
hErr
t
=
2
*
InputBox("请设置游戏时间,单位为秒:",形面形面
,
)
Caption
=
0
Timer1.Enabled
=
True
Command1.Enabled
=
False
hErr:
End
Sub
Private
Sub
Form_Load()
Timer1.Enabled
=
False
Randomize
For
Each
p
In
Picture1
p.FontName
=
"arial"
p.FontSize
=
Next
End
Sub
Private
Sub
Picture1_Click(Index
As
Integer)
If
Index
=
i
Then
Caption
=
Caption
+
1:
t
=
t
+
1:
Timer1_Timer
End
Sub
Private
Sub
Timer1_Timer()
For
Each
p
In
Picture1
p.Cls
Next
i
=
Int(Rnd
*
9)
Picture1(i).Print
i
+
1
t
=
t
-
1
Label1.Caption
=
"倒计时:"
&
Int(t
/
2)
If
t
=
0
Then
Timer1.Enabled
=
False:
MsgBox
"游戏结束,您共打到"
&
Caption
&
"次地鼠":
i
=
-1:
Command1.Enabled
=
True
End
Sub
如何用VB做一个简单计算器 要求实现加减乘除乘方开方功能
用记事本把这段代码复制过去,代码然后另存为.frm就可以了VERSION 5.
Begin VB.Form frmMain
Appearance = 0 'Flat
BackColor = &H&
BorderStyle = 3 'Fixed Dialog
Caption = "简单计算器"
ClientHeight =
ClientLeft =
ClientTop =
ClientWidth =
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight =
ScaleWidth =
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command
Caption = "^"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.PictureBox picDisplay
Appearance = 0 'Flat
BackColor = &H&
ForeColor = &H&
Height =
Left =
ScaleHeight =
ScaleWidth =
TabIndex =
Top =
Width =
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
BorderStyle = 0 'None
Height =
Left =
Locked = -1 'True
TabIndex =
Top = 0
Width =
End
Begin VB.Label lblOperation
Appearance = 0 'Flat
BackColor = &H&
ForeColor = &H&
Height =
Left =
TabIndex =
Top = 0
Width =
End
End
Begin VB.CommandButton Command9
Caption = "退格"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command8
Caption = "清零"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton cmdDot
Caption = "."
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command7
Caption = "Sqrt"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command6
Caption = "="
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command5
Caption = "/"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command4
Caption = "*"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command3
Caption = "-"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command2
Caption = "+"
Height =
Left =
TabIndex =
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "9"
Height =
Index = 9
Left =
TabIndex = 9
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "8"
Height =
Index = 8
Left =
TabIndex = 8
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "7"
Height =
Index = 7
Left =
TabIndex = 7
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "6"
Height =
Index = 6
Left =
TabIndex = 6
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "5"
Height =
Index = 5
Left =
TabIndex = 5
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "4"
Height =
Index = 4
Left =
TabIndex = 4
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "3"
Height =
Index = 3
Left =
TabIndex = 3
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "2"
Height =
Index = 2
Left =
TabIndex = 2
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "1"
Height =
Index = 1
Left =
TabIndex = 1
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "0"
Height =
Index = 0
Left =
TabIndex = 0
Top =
Width =
End
End
Attribute VB_Name = "frmmain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Data As Double
Private lOperation As Long
Private fClear As Boolean
Private Sub cmdDot_Click()
If InStr(1,计算积源积希望ol私服源码 Text1.Text, ".") <= 0 Then Text1.Text = Text1.Text & "."
End Sub
Private Sub Command1_Click(Index As Integer)
If fClear = True Then Text1.Text = "": fClear = False
Text1.Text = Text1.Text & Index
End Sub
Private Sub Command_Click()
If fClear = False Then
Select Case lOperation
Case 0
Case 1: Text1.Text = Data + Val(Text1.Text)
Case 2: Text1.Text = Data - Val(Text1.Text)
Case 3: Text1.Text = Data * Val(Text1.Text)
Case 4: If Val(Text1.Text) = 0 Then MsgBox "除数不等于0": Exit Sub Else Text1.Text = Data / Val(Text1.Text)
Case 5: Text1.Text = Data ^ Val(Text1.Text)
End Select
End If
Data = Val(Text1.Text)
fClear = True
lOperation = 5
lblOperation.Caption = "^"
End Sub
Private Sub Command2_Click()
If fClear = False Then
Select Case lOperation
Case 0
Case 1: Text1.Text = Data + Val(Text1.Text)
Case 2: Text1.Text = Data - Val(Text1.Text)
Case 3: Text1.Text = Data * Val(Text1.Text)
Case 4: If Val(Text1.Text) = 0 Then MsgBox "除数不等于0": Exit Sub Else Text1.Text = Data / Val(Text1.Text)
Case 5: Text1.Text = Data ^ Val(Text1.Text)
End Select
End If
Data = Val(Text1.Text)
fClear = True
lOperation = 1
lblOperation.Caption = "+"
End Sub
Private Sub Command3_Click()
If fClear = False Then
Select Case lOperation
Case 0
Case 1: Text1.Text = Data + Val(Text1.Text)
Case 2: Text1.Text = Data - Val(Text1.Text)
Case 3: Text1.Text = Data * Val(Text1.Text)
Case 4: If Val(Text1.Text) = 0 Then MsgBox "除数不等于0": Exit Sub Else Text1.Text = Data / Val(Text1.Text)
Case 5: Text1.Text = Data ^ Val(Text1.Text)
End Select
End If
Data = Val(Text1.Text)
fClear = True
lOperation = 2
lblOperation.Caption = "-"
End Sub
Private Sub Command4_Click()
If fClear = False Then
Select Case lOperation
Case 0
Case 1: Text1.Text = Data + Val(Text1.Text)
Case 2: Text1.Text = Data - Val(Text1.Text)
Case 3: Text1.Text = Data * Val(Text1.Text)
Case 4: If Val(Text1.Text) = 0 Then MsgBox "除数不等于0": Exit Sub Else Text1.Text = Data / Val(Text1.Text)
Case 5: Text1.Text = Data ^ Val(Text1.Text)
End Select
End If
Data = Val(Text1.Text)
fClear = True
lOperation = 3
lblOperation.Caption = "*"
End Sub
Private Sub Command5_Click()
If fClear = False Then
Select Case lOperation
Case 0
Case 1: Text1.Text = Data + Val(Text1.Text)
Case 2: Text1.Text = Data - Val(Text1.Text)
Case 3: Text1.Text = Data * Val(Text1.Text)
Case 4: If Val(Text1.Text) = 0 Then MsgBox "除数不等于0": Exit Sub Else Text1.Text = Data / Val(Text1.Text)
Case 5: Text1.Text = Data ^ Val(Text1.Text)
End Select
End If
Data = Val(Text1.Text)
fClear = True
lOperation = 4
lblOperation.Caption = "/"
End Sub
Private Sub Command6_Click()
If fClear = False Then
Select Case lOperation
Case 0
Case 1: Text1.Text = Data + Val(Text1.Text)
Case 2: Text1.Text = Data - Val(Text1.Text)
Case 3: Text1.Text = Data * Val(Text1.Text)
Case 4: If Val(Text1.Text) = 0 Then MsgBox "除数不等于0": Exit Sub Else Text1.Text = Data / Val(Text1.Text)
Case 5: Text1.Text = Data ^ Val(Text1.Text)
End Select
End If
Data = Val(Text1.Text)
fClear = True
lOperation = 0
lblOperation.Caption = ""
End Sub
Private Sub Command7_Click()
If Val(Text1.Text) <= 0 Then MsgBox "开方数大于等于0"
Text1.Text = Sqr(Val(Text1.Text))
Data = Val(Text1.Text)
fClear = True
lOperation = 0
lblOperation.Caption = ""
End Sub
Private Sub Command8_Click()
Text1.Text = ""
lOperation = 0
lblOperation.Caption = ""
End Sub
Private Sub Command9_Click()
If Len(Text1.Text) > 0 Then Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case Asc("0"): Command1_Click 0
Case Asc("1"): Command1_Click 1
Case Asc("2"): Command1_Click 2
Case Asc("3"): Command1_Click 3
Case Asc("4"): Command1_Click 5
Case Asc("5"): Command1_Click 4
Case Asc("6"): Command1_Click 6
Case Asc("7"): Command1_Click 7
Case Asc("8"): Command1_Click 8
Case Asc("9"): Command1_Click 9
Case Asc("."): cmdDot_Click
Case Asc("+"): Command2_Click
Case Asc("-"): Command3_Click
Case Asc("*"): Command4_Click
Case Asc("/"): Command5_Click
Case Asc("^"): Command_Click
Case Asc("s"): Command7_Click
Case Asc("S"): Command7_Click
Case vbKeyBack: Command9_Click
Case Asc("`"): Command8_Click
Case Asc("="): Command6_Click
Case : Command6_Click
End Select
KeyAscii = 0
End Sub
2024-11-18 12:05
2024-11-18 11:49
2024-11-18 11:44
2024-11-18 11:34
2024-11-18 10:48
2024-11-18 10:37
2024-11-18 10:18
2024-11-18 10:17