Red de conocimiento informático - Problemas con los teléfonos móviles - Programación VB, ¡apúrate, apúrate, apúrate, apúrate! ! ! ! ! ! ! ! ! ! ! ! ! !

Programación VB, ¡apúrate, apúrate, apúrate, apúrate! ! ! ! ! ! ! ! ! ! ! ! ! !

Guarde el siguiente código como Form1.frm

VERSIÓN 5.00

Comenzar VB.Form Form1

Caption="Form1"

ClientHeight = 8985

ClientLeft = 60

ClientTop = 345

ClientWidth = 10830

LinkTopic = "Form1"

ScaleHeight = 8985

ScaleWidth = 10830

StartUpPosition = 3 'Ventana predeterminada

Comenzar VB.CommandButton Command2

Título = "Enviar"

Alto = 615

Izquierda = 6960

TabIndex = 6

Arriba = 3840

Ancho = 2055

Fin

Inicio VB.TextBox Texto1

Alto = 1215

Izquierda = 7320

TabIndex = 5

Superior = 2160

Ancho = 1575

Fin

Inicio VB.Label Label14

Alto = 495

Izquierda = 9240

TabIndex = 15

Arriba = 1080

Ancho = 1455

Fin

Begin VB.Label Label13

Caption = "Tasa correcta:"

BeginProperty Font

Name = "宋体"

Tamaño = 15

Juego de caracteres = 134

Peso

= 400

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'Falso

EndProperty

ForeColor = amp;H000000FFamp;

Alto = 495

Izquierda = 7080

TabIndex = 14

Superior = 1080

Ancho = 1815

Fin

Inicio VB.Label Label6

Alto = 3015

Izquierda = 1200

TabIndex = 13

Superior = 5760

Ancho = 8535

Fin

Inicio VB.Label Label12

Título = "Registro de respuestas"

Alto = 495

Izquierda = 1200

TabIndex = 12

Arriba = 4560

Ancho = 2055

Fin

Inicio VB.Label Label11

Título = "Pregunta"

Fuente BeginProperty

Nombre = "宋体"

Tamaño = 15

Juego de caracteres = 134

Peso = 700

Subrayado = 0 'False

Cursiva = 0 'False

Tachado = 0 'False

EndProperty

ForeColor = amp; H000000FFamp;

Alto

t = 405

Izquierda = 5640

TabIndex = 11

Superior = 1080

Ancho = 855

Fin

Begin VB.Label Label10

Caption = "0"

BeginProperty Font

Nombre = "宋体"

Tamaño = 15

Juego de caracteres = 134

Peso = 700

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'Falso

EndProperty

ForeColor = amp; Izquierda = 4800

TabIndex = 10

Arriba = 1080

Ancho = 615

Fin

Inicio VB .Label Label9

Caption = "Pregunta, lo hice bien:"

BeginProperty Font

Nombre = "宋体"

Tamaño = 15

Juego de caracteres = 134

Peso = 700

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'False

EndProperty

ForeColor = amp;H000000FFamp;

Alto = 405

Izquierda = 2760 p>

Ta

bIndex = 9

Superior = 1080

Ancho = 1815

Fin

Inicio VB.Label Label8

Título = "1"

Fuente BeginProperty

Nombre = "宋体"

Tamaño = 15

Juego de caracteres = 134

Peso = 700

Subrayado = 0 'False

Cursiva = 0 'False

Tachado = 0 'False

EndProperty

ForeColor = amp;H00FF0000amp;

Alto = 405

Izquierda = 2040

TabIndex = 8

Superior = 1080

Ancho = 495

Fin

Inicio VB.Label Label7

Fuente BeginProperty

Nombre = "宋体"

Tamaño = 36

Conjunto de caracteres = 134

Peso = 700

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'Falso

EndProperty

ForeColor = amp;H000000FFamp;

Alto = 1215

Izquierda = 9360

TabIndex = 7

Superior = 2160

Ancho = 1215

Fin

> Begin VB.Label Label5

Caption = "="

BeginProperty Fuente

Nombre = "宋体"

Tamaño = 36

Juego de caracteres = 134

Peso = 700

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'False

EndProperty

Alto = 1095

Izquierda = 5880

TabIndex = 4

Superior = 2160

Ancho = 975

Fin

Inicio VB.Label Label4

Fuente BeginProperty

Nombre = "宋体"

Tamaño = 36

Conjunto de caracteres = 134

Peso = 700

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'Falso

EndProperty

Alto = 1095

Izquierda = 4080

TabIndex = 3

Superior = 2160

Ancho = 1335

Fin

Inicio VB.Label Label3 p>

Fuente BeginProperty

Nombre = "宋体"

Tamaño = 36

Juego de caracteres = 134

Peso =

700

Subrayado = 0 'False

Cursiva = 0 'False

Tachado = 0 'False

EndProperty

Alto = 1095

Izquierda = 2520

TabIndex = 2

Arriba = 2160

Ancho = 1215

Fin

Inicio VB.Label Label2

Fuente BeginProperty

Nombre = "宋体"

Tamaño = 36

Juego de caracteres = 134

Peso = 700

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'Falso

EndProperty

Alto = 975

Izquierda = 840

TabIndex = 1

Arriba = 2160

Ancho = 1215

Fin

Inicio VB.Label Etiqueta1

BackStyle = 0 'Transparente

Título = "Página actual:"

Fuente BeginProperty

Nombre = "宋体"

Tamaño = 15

Conjunto de caracteres = 134

Peso = 700

Subrayado = 0 'Falso

Cursiva = 0 'Falso

Tachado = 0 'Falso

Propiedad final

erty

ForeColor = amp;H000000FFamp;

Alto = 400

Izquierda = 720

TabIndex = 0

Superior = 1080

Ancho = 2295

Fin

Fin

Atributo VB_Name = "Form1"

Atributo VB_GlobalNameSpace = False

Atributo VB_Creatable = False

Atributo VB_PredeclaredId = True

Atributo VB_Exposed = False

Atenuar m como entero, n Como entero, f como entero

Private Sub Command2_Click()

Si Command2.Caption = "Enviar" Entonces

Si Text1.Text = "" Entonces

MsgBox "¡Por favor responda!"

De lo contrario

Si f = 1 Entonces

Si CInt(Label2.Caption) CInt(Label4. Título) = CInt(Text1.Text) Entonces

Etiqueta7.Caption = "√"

m = m 1

Si no

Label7.Caption = "×"

Fin si

ElseIf f = 2 Entonces

Si CInt(Label2.Caption) - CInt(Label4.Caption) = CInt(Text1.Text) Entonces

Label7.Caption = "√"

m = m 1

De lo contrario

Label7.Caption = "×"

Fin si

ElseIf f = 3 Entonces

Si CInt(Label2.Caption) * CInt(Label4.Caption) = CLng(Text1 .Text) Entonces

Label7.Caption = "√"

m = m 1

De lo contrario

Label7.Caption = "× "

Fin si

ElseIf f = 4 Entonces

Si CInt(Label2.Caption) / CInt(Label4.Caption) = CInt(Text1.Text) Entonces

Label7.Caption = "√"

m = m 1

Else

Label7.Caption = "×"

Fin si

End If

Command2.Caption = "Siguiente pregunta"

n = n 1

Dim jilu As String

jilu = Etiqueta2.Caption amp; Etiqueta3.Caption amp; Etiqueta4.Caption amp; "=" amp Texto1.Texto amp; .Caption = Label6.Caption & jilu

Finalizar si

ElseIf Command2.Caption = "Siguiente pregunta" Entonces

Llamar a Form_Load

Command2.Caption = "Enviar"

Label7.Caption = ""

Text1.Text = ""

Text1.SetFocus

Finalizar si

End Sub

Sub privado Form_Load()

Atenuar a, b, c como entero

Aleatorizar

a = CInt(Rnd() * 90 10)

b = CInt(Rnd() * 90 10)

f = Int(Rnd() * 4) 1

Si f = 1 entonces

Label3.Caption = " "

De lo contrario, si f = 2 entonces

Label3.Caption = "- "

Si a lt; b Entonces c = a: a = b: b = c

De lo contrario, Si f = 3 Entonces

Label3.Caption = "* "

ElseIf f = 4 Then

Label3.Caption = "/"

Mientras que un Mod b lt;gt; 0

b = CInt(Rnd() * 90 10)

Wend

End If

Label2.Caption = a

Label4.Caption = b

Etiqueta8.Caption = n 1

Etiqueta10

.Caption = m

Si n gt 0 Entonces Label13.Caption = Format(m / n, "0.00")

End Sub