【VB作业】急求VB高手指点迷津!!!

来自:日常事物办理    更新日期:早些时候
vb作业 急求VB高手!!!!!!!!!!!!!1~

文件清单:
==========================================================================
★★★★form1.frm
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 3690
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 3690
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "中奖号码"
Height = 735
Left = 240
TabIndex = 8
Top = 1680
Width = 3015
Begin VB.TextBox txt2
Height = 270
Index = 4
Left = 2400
TabIndex = 13
Text = "0"
Top = 240
Width = 375
End
Begin VB.TextBox txt2
Height = 270
Index = 3
Left = 1800
TabIndex = 12
Text = "0"
Top = 240
Width = 375
End
Begin VB.TextBox txt2
Height = 270
Index = 2
Left = 1320
TabIndex = 11
Text = "0"
Top = 240
Width = 375
End
Begin VB.TextBox txt2
Height = 270
Index = 1
Left = 840
TabIndex = 10
Text = "0"
Top = 240
Width = 375
End
Begin VB.TextBox txt2
Height = 270
Index = 0
Left = 240
TabIndex = 9
Text = "0"
Top = 240
Width = 375
End
End
Begin VB.Frame Frame1
Caption = "选号"
Height = 855
Left = 120
TabIndex = 1
Top = 120
Width = 3375
Begin VB.TextBox txt1
Height = 270
Index = 4
Left = 2880
TabIndex = 7
Text = "0"
Top = 360
Width = 375
End
Begin VB.TextBox txt1
Height = 270
Index = 3
Left = 2400
TabIndex = 6
Text = "0"
Top = 360
Width = 375
End
Begin VB.TextBox txt1
Height = 270
Index = 2
Left = 1920
TabIndex = 5
Text = "0"
Top = 360
Width = 375
End
Begin VB.TextBox txt1
Height = 270
Index = 1
Left = 1440
TabIndex = 4
Text = "0"
Top = 360
Width = 375
End
Begin VB.TextBox txt1
Height = 270
Index = 0
Left = 960
TabIndex = 3
Text = "0"
Top = 360
Width = 375
End
Begin VB.CommandButton Cmd1
Caption = "机选"
Height = 375
Left = 120
TabIndex = 2
Top = 240
Width = 735
End
End
Begin VB.CommandButton Cmd2
Caption = "摇奖"
Height = 375
Left = 840
TabIndex = 0
Top = 1200
Width = 1815
End
Begin VB.Label lbl
Caption = "中奖情况"
Height = 255
Left = 240
TabIndex = 14
Top = 2640
Width = 3015
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Function Xuan(d() As Integer) '产生5个随机数
On Error Resume Next
Dim a(4) As Integer
RE:
t = 0
Do
d(t) = ((30 * Rnd() \ 1) + 1)
t = t + 1
Loop Until t > 4.5
For i = 0 To 4
a(i) = d(i)
Next
For i = 0 To 4
For j = 0 To 4
If a(j) > a(i) Then
q = a(i)
a(i) = a(j)
a(j) = q
End If
Next
Next
For i = 0 To 3
If a(i) = a(i + 1) Then GoTo RE
Next
End Function
Private Sub Cmd1_Click()
Dim f(4) As Integer
Xuan f()
For i = 0 To 4
txt1(i).Text = f(i)
Next
End Sub
Private Sub Cmd2_Click()
On Error Resume Next
q = 0
For i = 0 To 4
For x = 0 To 4
If x i And Val(txt1(x)) = Val(txt1(i)) Then q = 1: Exit For
Next
Next
If q = 1 Then MsgBox "号有重复的;请重新选号": Exit Sub
Dim a(4) As Integer
Xuan a()
t = 0
For i = 0 To 4
txt2(i).Text = a(i)
For j = 0 To 4
If a(i) = Int(Val(txt1(j).Text)) Then t = t + 1
Next
Next
Select Case t
Case 0
lbl.Caption = "遗憾!没有中奖"
Case 1
lbl.Caption = "恭喜!您中了五等奖"
Case 2
lbl.Caption = "恭喜!您中了四等奖"
Case 3
lbl.Caption = "恭喜!您中了三等奖"
Case 4
lbl.Caption = "恭喜!您中了二等奖"
Case 5
lbl.Caption = "恭喜!!!您中了一等奖"
End Select
End Sub
=========================================================================
★★★★MSSCCPRJ.SCC
[SCC]
SCC=This is a source code control file
[工程1.vbp]
SCC_Project_Name=this project is not under source code control
SCC_Aux_Path=
=========================================================================
★★★★工程1.vbp
Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
Startup="Form1"
Command32=""
Name="工程1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="-"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1
=========================================================================
=========================================================================
共3个文件

1、Private Sub Command1_Click()
Randomize
Dim a(1 To 10)
For i = 1 To 10
a(i) = Int(Rnd * 10000) + 1
Print a(i)
Next i
Min = 10000
For i = 1 To 10
If a(i) < Min Then Min = a(i)
Next i
Print "最小值为"; Min
End Sub

2、
Private Sub VScroll1_Change()
Randomize
n = Int(Rnd() * 19) + 2
Text1.Text = n
For i = 1 To n
p = 1
For j = 1 To i
p = p * j
Next j
s = s + p
Next i
Label1.Caption = s
Label2.Caption = "1!+2!+...+" & n & "!="
End Sub

完全照你图做的:
Private Sub Command1_Click()
Dim a() As Integer
Print "1000以内的完数:"
For i = 6 To 1000
s = 0
n = 0
t = ""
For j = 1 To i - 1
If i Mod j = 0 Then
s = s + j
n = n + 1
ReDim Preserve a(n)
a(n) = j
End If
Next j
For k = 1 To n
t = t & Str(a(k))
Next k
If i = s Then Print i & "的因子有:" & t & " 是完数"
Next i
End Sub

Private Sub Command1_Click()
Dim i As Integer, j As Integer, s As Integer, x As String
Print "1000以内的完数:"
For i = 1 To 1000
For j = 1 To i - 1
If i Mod j = 0 Then s = s + j: x = x & j & " "
Next
If s = i Then Print i & "的因子数有:"; x; "是完数"
s = 0: x = ""
Next
End Sub

Private Sub Form_Load()
Dim i&, j&
Dim SUM&, sList$
For i = 1 To 1000
SUM = 0
sList = ""
For j = 1 To i - 1
If i Mod j = 0 Then
SUM = SUM + j
sList = sList & IIf(sList = "", "", vbTab) & j
End If
Next
If SUM = i Then
Debug.Print i & "的因子有:" & sList & "是完数"
End If
Next
End Sub


【VB作业】急求VB高手指点迷津!!!视频

相关评论:
  • 13935793595有VB高手么?小弟问几个问题。 谢谢大家了,我刚学。
    应梵泰第一个结果是:20 第二个程序中语法有问题:N(i)=2t+1 应改正为N(i) = 2 * t + 1,这样输出结果为11,3 第三个程序语法也有问题:s = s+a(i)j j=j10 这两句可能是抄错了,语法有问题,记住,两个字符相乘中间要用*号 第四个程序运行结果为4 第五个程序中的k = k + p(i) ...

  • 13935793595VB高手进来指点一下,我要详解越详越好,够好一定追加分
    应梵泰VB高手进来指点一下,我要详解越详越好,够好一定追加分 这些程序我调试出来都不和我算的相同。我算得第一题得2,2;二题得14;三题得9希望详解,谢谢一。PrivateSubCommand1_Click()A=0:B=0ForI=-lTo-2Step-lForJ=lTo2B=B+lNextJA=A+lNextI... 这些程序我调试出来都不和我算的相同。我算得第一题...

  • 13935793595请高手指教这条VB过程怎么读?它出来后结果是什么?请最好能详细的把你...
    应梵泰输出结果如图所示。我的分析:(1)第一次循环:k=0 for j=1 to k+1 (即j=1)x=k+1=0+1=1 A(1)=A(1)=A(0)=0 因为k=0<n-1 所以这里 Exit For 直接运行next j后面的print k,所以有了输出结果的第一个0 (2)第二次循环:k=1 for j=1 to 2 j=1 x=2 A(2)=...

  • 13935793595VB编程的问题,麻烦高手指点指点.
    应梵泰VB编程的问题,麻烦高手指点指点. 在我们编程的时候,很多的时候我们都在声明一个变量,而我呢?却不知道把这个变量是用什么类型的,麻烦你们把所有的类型告诉我,还有它们的类型是在什么情况下使用,它们的范围是什么... 在我们编程的时候,很多的时候我们都在声明一个变量,而我呢?却不知道把这个变量是用什么类型的,...

  • 13935793595VB高手指点一下(好的追分啊)
    应梵泰用结构体数组记录坐标数组就可以了

  • 13935793595请VB高手帮我解决一下下面一个问题
    应梵泰这是因为你每次设置了Adodc1的RecordSource属性后,数据库中的记录并不是立刻改变的,这时候删除的话就会删除原来的记录了,要用Adodc1.Refresh刷新一下才会变为新的记录。另外,删除完毕后,要再次设置Adodc1的RecordSource属性为打开数据库内的所有记录,然后再用Adodc1.Refresh刷新,这样才会显示出删除该...

  • 13935793595VB高手请指点:学生姓名和成绩数据若干,按成绩从高到低降序排序_百度知 ...
    应梵泰Private Sub Command1_Click()Dim sTxt$, sDt, Dt(), tTxt ---数据读取--- sTxt = Text1.Text sDt = Split(sTxt, ;)ReDim Dt(UBound(sDt))For i = 0 To UBound(sDt)Dt(i) = Split(sDt(i), :)If UBound(Dt(i)) 1 Then Exit For Next i ReDim Preserve Dt(i - 1)-...

  • 13935793595关于VB的一些问题,请高手讲解一下,下面这个程序答案是多少,为什么是这 ...
    应梵泰=== X的最终值是15 i从1到4,每次循环都重新赋值X=4,所以直接看i=4即可;j从1到3,每次循环都重新赋值X=3,会覆盖前面的X=4;所以j=3即可。k从1到2,循环开始前x=3,当k=1时,x=x+6=3+6=9;当k=2时,x=x+6=9+6=15;也就是X=3之前的循环都是没用的(i=4,j=3根本没...

  • 13935793595急求VB代码 请高手指点
    应梵泰新建工程,窗体FORM1,添加按钮Command1,计时器Timer1,Timer2 Timer1,Timer2的Enabled属性都改成False,Interval属性都改成300 窗口代码 Private a As Integer Private b As Integer Public Sub Command1_Click()Timer1.Enabled = False Timer2.Enabled = False End Sub Private Sub Form_Load()a = 1...

  • 13935793595请教VB高手~有急用!
    应梵泰Dim x1 As Decimal Dim x2 As Decimal Dim x3 As Decimal Dim min As Decimal Dim a As Decimal Dim b As Decimal Dim c As Decimal min = 1000000 For x1 = 0.0 To 1.0 Step 0.01 For x2 = 0.0 To 1.0 Step 0.01 For x3 = 0.0 To 1.0 Step 0.01 If 3800 * x1 +...

  • 相关主题精彩

    版权声明:本网站为非赢利性站点,内容来自于网络投稿和网络,若有相关事宜,请联系管理员

    Copyright © 喜物网