Тема: [VisualBasic][.NET] Якою мовою це написано ?
Якою мовою це написано ?
Public Class Form1
    Public Const g As Double = 9.81
    Public Const pi As Double = 3.14
    Dim v, phi As Double
    Dim x, y, vx, vy, ax, ay As Double
    Dim xe, ye As Double
    Dim r As Double = 2
    Dim dt As Double = 0.1
    Dim xt As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       MaskedTextBox2.Text = 30
       MaskedTextBox3.Text = 70
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim graph As Graphics = PictureBox1.CreateGraphics
        Dim black = New Pen(Drawing.Color.Black, 1)
        v = MaskedTextBox2.Text
        phi = MaskedTextBox3.Text
        phi = phi * pi / 180
        vy = v * Math.Sin(phi) 
        vx = v * Math.Cos(phi)
        x = 0
        y = 1
        While y > 0
            ay = -g
            y = y + vy * dt + ay * Math.Pow(dt, 2) / 2
            vy = vy + ay * dt
            x = x + vx * dt
            ye = 300 - y
            xe = x
            Dim rect As Rectangle
            rect.X = xe + r
            rect.Y = ye + r
            rect.Width = 2 * r
            rect.Height = 2 * r
            graph.DrawEllipse(black, rect)
        End While
        If xe > xt - 20 And xe < xt + 20 Then
            Label1.Text = "Вы победили!"
        End If
        If Not (xe > xt - 20 And xe < xt + 20) Then
            Label1.Text = "Вы проиграли."
        End If
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        PictureBox1.Refresh()
        Dim graph As Graphics = PictureBox1.CreateGraphics
        Dim black = New Pen(Drawing.Color.Black, 1
        Dim random As New Random()
        xt = 30 + random.Next(0, 100)
        xt = random.Next(0, 400)
        graph.DrawLine(black, xt - 20, 300, xt + 20, 300)
    End Sub
End Class