Advertisement
ManuMaloka

Tarefa_20_Caty

May 26th, 2023
1,079
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.     Dim xmatriz(2, 3) As Integer
  3.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  4.         '1º botão anterior
  5.        GroupBox5.Visible = False
  6.         GroupBox4.Visible = True
  7.  
  8.         RadioButton4.Checked = False
  9.         RadioButton5.Checked = False
  10.         RadioButton6.Checked = False
  11.  
  12.  
  13.     End Sub
  14.  
  15.     Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  16.         '2º botão anterior
  17.        GroupBox6.Visible = False
  18.         GroupBox5.Visible = True
  19.     End Sub
  20.  
  21.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  22.         '1º botão seguinte
  23.        GroupBox5.Visible = True
  24.         Button3.Visible = False
  25.     End Sub
  26.  
  27.     Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  28.         '2º botão seguinte
  29.        GroupBox6.Visible = True
  30.  
  31.     End Sub
  32.  
  33.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  34.         'inicializar a matriz
  35.        xmatriz(1, 1) = 3
  36.         xmatriz(1, 2) = 1
  37.         xmatriz(1, 3) = 2
  38.         xmatriz(2, 1) = 0
  39.         xmatriz(2, 2) = 0
  40.         xmatriz(2, 3) = 0
  41.     End Sub
  42.     'resposta 1
  43.    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
  44.         xmatriz(2, 1) = 1
  45.         Button1.Visible = True
  46.     End Sub
  47.     'resposta 1
  48.    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged
  49.         xmatriz(2, 1) = 2
  50.         Button1.Visible = True
  51.     End Sub
  52.     'resposta 1
  53.    Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.CheckedChanged
  54.         xmatriz(2, 1) = 3
  55.         Button1.Visible = True
  56.     End Sub
  57.  
  58.     'resposta 2
  59.    Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.CheckedChanged
  60.         xmatriz(2, 2) = 1
  61.         Button3.Visible = True
  62.     End Sub
  63.     'resposta 2
  64.    Private Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton5.CheckedChanged
  65.         xmatriz(2, 2) = 2
  66.         Button3.Visible = True
  67.     End Sub
  68.     'resposta 2
  69.    Private Sub RadioButton6_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton6.CheckedChanged
  70.         xmatriz(2, 2) = 3
  71.         Button3.Visible = True
  72.     End Sub
  73.  
  74.     'resposta 3
  75.    Private Sub RadioButton7_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton7.CheckedChanged
  76.         xmatriz(2, 3) = 1
  77.  
  78.         RadioButton7.Checked = False
  79.         RadioButton8.Checked = False
  80.         RadioButton9.Checked = False
  81.  
  82.     End Sub
  83.     'resposta 3
  84.    Private Sub RadioButton8_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton8.CheckedChanged
  85.         xmatriz(2, 3) = 2
  86.     End Sub
  87.     'resposta 3
  88.    Private Sub RadioButton9_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton9.CheckedChanged
  89.         xmatriz(2, 3) = 3
  90.     End Sub
  91.  
  92.     Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  93.         ' Contagem das respostas corretas
  94.        Dim i, xcorretas As Integer
  95.         xcorretas = 0
  96.         For i = 1 To 3
  97.             If xmatriz(1, i) = xmatriz(2, i) Then
  98.                 xcorretas = xcorretas + 1
  99.             End If
  100.  
  101.         Next i
  102.         MsgBox("Acertou" & Str(xcorretas) & " perguntas.", 64, "Resultado")
  103.         GroupBox4.Visible = False
  104.         GroupBox5.Visible = False
  105.         GroupBox6.Visible = False
  106.     End Sub
  107.  
  108.     Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  109.         'Botão sair
  110.        Application.Exit()
  111.     End Sub
  112.  
  113.     Private Sub PictureBox5_Click(sender As Object, e As EventArgs) Handles PictureBox5.Click
  114.         ' Contagem das respostas corretas
  115.        Dim i, xcorretas As Integer
  116.         xcorretas = 0
  117.         For i = 1 To 3
  118.             If xmatriz(1, i) = xmatriz(2, i) Then
  119.                 xcorretas = xcorretas + 1
  120.             End If
  121.  
  122.         Next i
  123.         MsgBox("Acertou" & Str(xcorretas) & " perguntas.", 64, "Resultado")
  124.         GroupBox4.Visible = False
  125.         GroupBox5.Visible = False
  126.         GroupBox6.Visible = False
  127.     End Sub
  128.  
  129.     Private Sub PictureBox6_Click(sender As Object, e As EventArgs) Handles PictureBox6.Click
  130.         'Botão sair
  131.        Application.Exit()
  132.     End Sub
  133. End Class
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement