vb作业 急求VB高手!!!!!!!!!!!!!1

作业要求:编写一个简易的30选5彩票摇奖程序。功能要求:用户可以输入5个不同的整数,或通过“机选”按钮,自动生成5个互不相同的随机数;单击“摇奖”按钮,生成中奖号码并对用... 作业要求:编写一个简易的30选5彩票摇奖程序。功能要求:用户可以输入5个不同的整数,或通过“机选”按钮,自动生成5个互不相同的随机数;单击“摇奖”按钮,生成中奖号码并对用户输入或机选的彩票数字进行评奖,如果用户选对一个数字,获5等奖,选对两个数字获4等奖。。。。以此类推。急求,希望各位高手尽快啊,绝不吝惜分啊 展开
 我来答 举报
信心安J
2012-06-05 · TA获得超过402个赞
知道小有建树答主
回答量:787
采纳率:0%
帮助的人:741万
展开全部

文件清单:

==========================================================================

★★★★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=<This is an empty string for the mssccprj.scc file>

=========================================================================

★★★★工程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个文件

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式